Overview

Namespaces

  • Composer
    • Autoload
  • Guzzle
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
        • Header
      • QueryAggregator
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Mock
    • Stream
  • Mockery
    • Adapter
      • Phpunit
    • CountValidator
    • Exception
    • Generator
      • StringManipulation
        • Pass
    • Loader
    • Matcher
  • None
  • Omnipay
    • Common
      • Exception
      • Message
    • Dummy
      • Message
    • Fatzebra
      • Message
  • PHP
  • Symfony
    • Component
      • EventDispatcher
        • Debug
        • DependencyInjection
        • Tests
          • Debug
          • DependencyInjection
      • HttpFoundation
        • File
          • Exception
          • MimeType
        • Session
          • Attribute
          • Flash
          • Storage
            • Handler
            • Proxy
        • Tests
          • File
            • MimeType
          • Session
            • Attribute
            • Flash
            • Storage
              • Handler
              • Proxy
      • Yaml
        • Exception
        • Tests

Classes

  • Symfony\Component\Yaml\Tests\A
  • Symfony\Component\Yaml\Tests\B
  • Symfony\Component\Yaml\Tests\DumperTest
  • Symfony\Component\Yaml\Tests\InlineTest
  • Symfony\Component\Yaml\Tests\ParseExceptionTest
  • Symfony\Component\Yaml\Tests\ParserTest
  • Symfony\Component\Yaml\Tests\YamlTest
  • Overview
  • Namespace
  • Function
  • Tree
  1: <?php
  2: /**
  3:  * Mockery
  4:  *
  5:  * LICENSE
  6:  *
  7:  * This source file is subject to the new BSD license that is bundled
  8:  * with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://github.com/padraic/mockery/blob/master/LICENSE
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to padraic@php.net so we can send you a copy immediately.
 14:  *
 15:  * @category   Mockery
 16:  * @package    Mockery
 17:  * @copyright  Copyright (c) 2010-2014 Pádraic Brady (http://blog.astrumfutura.com)
 18:  * @license    http://github.com/padraic/mockery/blob/master/LICENSE New BSD License
 19:  */
 20: 
 21: namespace Mockery;
 22: 
 23: class CompositeExpectation implements ExpectationInterface
 24: {
 25: 
 26:     /**
 27:      * Stores an array of all expectations for this composite
 28:      *
 29:      * @var array
 30:      */
 31:     protected $_expectations = array();
 32: 
 33:     /**
 34:      * Add an expectation to the composite
 35:      *
 36:      * @param \Mockery\Expectation|\Mockery\CompositeExpectation $expectation
 37:      * @return void
 38:      */
 39:     public function add($expectation)
 40:     {
 41:         $this->_expectations[] = $expectation;
 42:     }
 43: 
 44:     public function andReturn()
 45:     {
 46:         return $this->__call(__FUNCTION__, func_get_args());
 47:     }
 48: 
 49:     /**
 50:      * Intercept any expectation calls and direct against all expectations
 51:      *
 52:      * @param string $method
 53:      * @param array $args
 54:      * @return self
 55:      */
 56:     public function __call($method, array $args)
 57:     {
 58:         foreach ($this->_expectations as $expectation) {
 59:             call_user_func_array(array($expectation, $method), $args);
 60:         }
 61:         return $this;
 62:     }
 63: 
 64:     /**
 65:      * Return order number of the first expectation
 66:      *
 67:      * @return int
 68:      */
 69:     public function getOrderNumber()
 70:     {
 71:         reset($this->_expectations);
 72:         $first = current($this->_expectations);
 73:         return $first->getOrderNumber();
 74:     }
 75: 
 76:     /**
 77:      * Return the parent mock of the first expectation
 78:      *
 79:      * @return \Mockery\MockInterface
 80:      */
 81:     public function getMock()
 82:     {
 83:         reset($this->_expectations);
 84:         $first = current($this->_expectations);
 85:         return $first->getMock();
 86:     }
 87: 
 88:     /**
 89:      * Mockery API alias to getMock
 90:      *
 91:      * @return \Mockery\MockInterface
 92:      */
 93:     public function mock()
 94:     {
 95:         return $this->getMock();
 96:     }
 97: 
 98:     /**
 99:      * Starts a new expectation addition on the first mock which is the primary
100:      * target outside of a demeter chain
101:      *
102:      * @return \Mockery\Expectation
103:      */
104:     public function shouldReceive()
105:     {
106:         $args = func_get_args();
107:         reset($this->_expectations);
108:         $first = current($this->_expectations);
109:         return call_user_func_array(array($first->getMock(), 'shouldReceive'), $args);
110:     }
111: 
112:     /**
113:      * Return the string summary of this composite expectation
114:      *
115:      * @return string
116:      */
117:     public function __toString()
118:     {
119:         $return = '[';
120:         $parts = array();
121:         foreach ($this->_expectations as $exp) {
122:             $parts[] = (string) $exp;
123:         }
124:         $return .= implode(', ', $parts) . ']';
125:         return $return;
126:     }
127: 
128: }
129: 
Omnipay Fat Zebra / Paystream Gateway Module API Documentation API documentation generated by ApiGen