コード例 #1
0
 /**
  * {@inheritdoc}
  */
 protected function createDoubleClass(ReflectionClass $class = null, array $interfaces)
 {
     $classId = $this->generateClassId($class, $interfaces);
     if (isset($this->classes[$classId])) {
         return $this->classes[$classId];
     }
     return $this->classes[$classId] = parent::createDoubleClass($class, $interfaces);
 }
コード例 #2
0
ファイル: Prophet.php プロジェクト: papillon-cendre/d8
 /**
  * Initializes Prophet.
  *
  * @param null|Doubler           $doubler
  * @param null|RevealerInterface $revealer
  * @param null|StringUtil        $util
  */
 public function __construct(Doubler $doubler = null, RevealerInterface $revealer = null, StringUtil $util = null)
 {
     if (null === $doubler) {
         $doubler = new Doubler();
         $doubler->registerClassPatch(new ClassPatch\SplFileInfoPatch());
         $doubler->registerClassPatch(new ClassPatch\TraversablePatch());
         $doubler->registerClassPatch(new ClassPatch\DisableConstructorPatch());
         $doubler->registerClassPatch(new ClassPatch\ProphecySubjectPatch());
         $doubler->registerClassPatch(new ClassPatch\ReflectionClassNewInstancePatch());
         $doubler->registerClassPatch(new ClassPatch\HhvmExceptionPatch());
         $doubler->registerClassPatch(new ClassPatch\MagicCallPatch());
         $doubler->registerClassPatch(new ClassPatch\KeywordPatch());
     }
     $this->doubler = $doubler;
     $this->revealer = $revealer ?: new Revealer();
     $this->util = $util ?: new StringUtil();
 }
コード例 #3
0
 /**
  * @param \Prophecy\Doubler\Doubler                   $doubler
  * @param \Prophecy\Prophecy\ProphecySubjectInterface $double
  */
 function let($doubler, $double)
 {
     $doubler->double(null, array())->willReturn($double);
     $this->beConstructedWith($doubler);
 }
コード例 #4
0
 /**
  * @param \Prophecy\Doubler\Doubler                   $doubler
  * @param \Prophecy\Prophecy\ProphecySubjectInterface $reflection
  */
 function it_returns_new_MethodProphecy_for_different_signatures($doubler, $reflection)
 {
     $doubler->double(Argument::any())->willReturn($reflection);
     $this->addMethodProphecy($methodProphecy1 = $this->getProphecy(3, 2, 1));
     $methodProphecy2 = $this->getProphecy(1, 2, 3);
     $methodProphecy2->shouldNotBe($methodProphecy1);
 }
コード例 #5
0
ファイル: ObjectProphecySpec.php プロジェクト: eunicon/meetup
 /**
  * @param \Prophecy\Doubler\Doubler                   $doubler
  * @param \Prophecy\Prophecy\ProphecySubjectInterface $reflection
  */
 function it_returns_new_MethodProphecy_for_different_signatures($doubler, $reflection)
 {
     $doubler->double(Argument::any())->willReturn($reflection);
     $value = new ObjectProphecySpecFixtureB('ABC');
     $value2 = new ObjectProphecySpecFixtureB('CBA');
     $this->addMethodProphecy($methodProphecy1 = $this->getProphecy(1, 2, 3, $value));
     $methodProphecy2 = $this->getProphecy(1, 2, 3, $value2);
     $methodProphecy2->shouldNotBe($methodProphecy1);
 }
コード例 #6
0
 function it_returns_new_MethodProphecy_for_all_callback_signatures(Doubler $doubler, ProphecySubjectInterface $reflection)
 {
     $doubler->double(Argument::any())->willReturn($reflection);
     $this->addMethodProphecy($methodProphecy1 = $this->getProphecy(function () {
     }));
     $methodProphecy2 = $this->getProphecy(function () {
     });
     $methodProphecy2->shouldNotBe($methodProphecy1);
 }
コード例 #7
0
ファイル: ProphetSpec.php プロジェクト: phpspec/prophecy
 function let(Doubler $doubler, ProphecySubjectInterface $double)
 {
     $doubler->double(null, array())->willReturn($double);
     $this->beConstructedWith($doubler);
 }