public function testFactoryReturnsAddedEncapsulators()
 {
     $encapsulator = $this->getMock('\\DICIT\\Encapsulator');
     $factory = new EncapsulatorFactory();
     $factory->addEncapsulator($encapsulator);
     $this->assertContains($encapsulator, $factory->getEncapsulators());
 }
Exemple #2
0
 /**
  * Interceptor handler
  * @param  object $class
  * @param  array $serviceConfig
  * @return object
  */
 protected function encapsulate($class, $serviceConfig)
 {
     $encapsulators = $this->encapsulatorFactory->getEncapsulators();
     foreach ($encapsulators as $encapsulator) {
         $class = $encapsulator->encapsulate($this, $class, $serviceConfig);
     }
     return $class;
 }