コード例 #1
0
ファイル: ArgumentCaptorTest.php プロジェクト: ngyuki/phake
 public function testToStringWithConditional()
 {
     $matcher = Phake::mock('Phake_Matchers_IArgumentMatcher');
     Phake::when($matcher)->__toString()->thenReturn('an argument');
     $this->captor->when($matcher);
     $this->assertEquals('<captured parameter that is an argument>', $this->captor->__toString());
 }
コード例 #2
0
 public function testBindAllCapturedValuePostMatch()
 {
     $value1 = array(new stdClass());
     $value2 = array(new stdClass());
     $value3 = array(new stdClass());
     $this->captor->doArgumentsMatch($value1);
     $this->captor->doArgumentsMatch($value2);
     $this->captor->doArgumentsMatch($value3);
     $this->captor->bindAllCapturedValues($allCaptures);
     $this->assertSame($this->refVariable, $value3[0]);
     $this->assertSame(array($value1[0], $value2[0], $value3[0]), $allCaptures);
 }
コード例 #3
0
ファイル: Phake.php プロジェクト: kore/Phake
 /**
  * Returns a capturing matcher that is bound to store ALL of its calls in the variable passed in.
  *
  * $value will initially be set to an empty array;
  *
  * @param mixed $value - Will be set to the value of the called argument.
  *
  * @return Phake_Matchers_ArgumentCaptor
  */
 public static function captureAll(&$value)
 {
     $ignore = null;
     $captor = new Phake_Matchers_ArgumentCaptor($ignore);
     $captor->bindAllCapturedValues($value);
     return $captor;
 }