Esempio n. 1
0
 /**
  * @return \Doubles\Interceptor\IInterceptor
  */
 public static function partial($object)
 {
     $subject = Core\Subject::fromInstance($object);
     $testDouble = new Core\TestDouble();
     $testDouble->addComponent(new Spy\SpyComponent());
     $expectationComponent = new ExpectationComponent();
     $stubComponent = new StubComponent();
     $mockComponent = new Mock\MockComponent();
     $interceptorComponent = new InterceptorComponent($object);
     $expectationComponent->addExpecter($stubComponent);
     $expectationComponent->addExpecter($mockComponent);
     $expectationComponent->addExpecter($interceptorComponent);
     $testDouble->addComponent(new PartialComponent($expectationComponent));
     $testDouble->addComponent($expectationComponent);
     $testDouble->addComponent($stubComponent);
     $testDouble->addComponent($mockComponent);
     $testDouble->addComponent($interceptorComponent);
     $partial = Core\TestDoubleFactory::create($subject, $testDouble, 'Partial%s');
     PartialComponent::mergeSubjectToPartial($object, $partial);
     return $partial;
 }