Esempio n. 1
0
 /**
  * @covers \OcraServiceManager\ServiceManager\Logger::logServiceManagerCreate
  * @covers \OcraServiceManager\ServiceManager\Logger::registerServiceCall
  */
 public function testLogServiceManagerCreate()
 {
     $serviceLocator = $this->getMock('Zend\\ServiceManager\\ServiceLocatorInterface');
     $instance = new \stdClass();
     $event = $this->getMockBuilder('OcraServiceManager\\ServiceManager\\Event\\ServiceManagerEvent')->disableOriginalConstructor()->getMock();
     $event->expects($this->any())->method('getServiceLocator')->will($this->returnValue($serviceLocator));
     $event->expects($this->any())->method('getInstance')->will($this->returnValue($instance));
     $event->expects($this->any())->method('getCanonicalName')->will($this->returnValue('canonical-name'));
     $event->expects($this->any())->method('getRequestedName')->will($this->returnValue('requested\\name'));
     $event->expects($this->any())->method('getTrace')->will($this->returnValue(array()));
     $result = $this->listener->logServiceManagerCreate($event);
     $this->assertSame($instance, $result['instance']);
     $this->assertSame($serviceLocator, $result['service_locator']);
     $this->assertSame('requested\\name', $result['requested_name']);
     $this->assertSame('canonical-name', $result['canonical_name']);
     $this->assertSame('create', $result['method']);
     $this->assertInternalType('array', $result['trace']);
 }