Exemple #1
0
 /**
  * Tests the factorying of multiple matchers
  */
 public function testCreatingMultipleMatchers()
 {
     $arguments = array('foo', $argMatcher = $this->getMock('Phake_Matchers_IArgumentMatcher'), $this->getMock('PHPUnit_Framework_Constraint'));
     $matchers = $this->factory->createMatcherArray($arguments);
     $this->assertInstanceOf('Phake_Matchers_EqualsMatcher', $matchers[0]);
     $this->assertSame($argMatcher, $matchers[1]);
     $this->assertInstanceOf('Phake_Matchers_PHPUnitConstraintAdapter', $matchers[2]);
 }
Exemple #2
0
 /**
  * A call magic method to provide a more fluent interface to the verifier.
  *
  * @param string $method
  * @param array  $arguments
  *
  * @return Phake_CallRecorder_VerifierResult
  */
 public function __call($method, array $arguments)
 {
     $expectation = new Phake_CallRecorder_CallExpectation($this->verifier->getObject(), $method, $this->matcherFactory->createMatcherArray($arguments), $this->mode, $this->mockReader);
     $result = $this->verifier->verifyCall($expectation);
     return $this->client->processVerifierResult($result);
 }
Exemple #3
0
 /**
  * A magic call to instantiate an Answer Binder Proxy.
  *
  * @param string $method
  * @param array  $arguments
  *
  * @return Phake_Proxies_AnswerBinderProxy
  */
 public function __call($method, array $arguments)
 {
     $matcher = new Phake_Matchers_MethodMatcher($method, $this->matcherFactory->createMatcherArray($arguments));
     $binder = new Phake_Stubber_AnswerBinder($this->obj, $matcher, $this->mockReader);
     return new Phake_Proxies_AnswerBinderProxy($binder);
 }
Exemple #4
0
 /**
  * Returns a new stubber specifically for the __call() method
  *
  * @param mixed ... A vararg containing the expected arguments for this call
  *
  * @return \Phake_Proxies_CallStubberProxy
  */
 public static function whenCallMethodWith()
 {
     $arguments = func_get_args();
     $factory = new Phake_Matchers_Factory();
     return new Phake_Proxies_CallStubberProxy($factory->createMatcherArray($arguments), new Phake_MockReader());
 }