12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
-
-
-
-
-
-
-
-
-
- class Yay_InvocationProxy implements Yay_ExpectationProvider
- {
-
-
-
- private $_recorder;
-
-
-
- private $_mock;
-
-
-
- public function __construct(Yay_InvocationRecorder $recorder, Yay_MockObject $mock)
- {
- $this->_recorder = $recorder;
- $this->_mock = $mock;
- }
-
-
-
- public function __call($method, $args)
- {
- if (is_callable(array($this->_mock, $method)))
- {
- $invocation = new Yay_SimpleInvocation($this->_mock, $method, $args);
- $this->_recorder->recordInvocation($invocation);
- return $this->_recorder;
- }
- elseif (is_callable(array($this->_recorder, $method)))
- {
- return call_user_func_array(array($this->_recorder, $method), $args);
- }
- else
- {
- throw new BadMethodCallException('Mock method ' . $method . ' does not exist');
- }
- }
-
-
-
- public function getExpectations()
- {
- return $this->__call(__FUNCTION__, array());
- }
-
- }
|