/**
  * {@inheritDoc}
  *
  * @covers \OcraServiceManager\ServiceManager\Event\ServiceManagerEvent
  */
 public function testBuildEvent()
 {
     $locator = $this->getMock('Zend\\ServiceManager\\ServiceLocatorInterface');
     $instance = new stdClass();
     $event = new ServiceManagerEvent('testEventName', $locator, $instance, 'serviceName', 'serviceName');
     $this->assertSame('testEventName', $event->getName());
     $this->assertSame($locator, $event->getServiceLocator());
     $this->assertSame('serviceName', $event->getRequestedName());
     $this->assertSame('serviceName', $event->getParam('requested_name'));
     $this->assertSame('serviceName', $event->getCanonicalName());
     $this->assertSame('serviceName', $event->getParam('canonical_name'));
     $this->assertSame($instance, $event->getInstance());
     $this->assertSame($instance, $event->getParam('instance'));
     $trace = $event->getTrace();
     $this->assertInternalType('array', $trace);
     $this->assertSame($trace, $event->getParam('trace'));
     $this->assertSame($this, $trace[1]['object']);
 }
Exemplo n.º 2
0
 /**
  * @param ServiceManagerEvent $event
  *
  * @return array|bool
  */
 public function logServiceManagerCreate(ServiceManagerEvent $event)
 {
     return $this->registerServiceCall($event->getServiceLocator(), $event->getInstance(), $event->getCanonicalName(), $event->getRequestedName(), 'create', $event->getTrace());
 }