示例#1
0
 public function testOnBootStrapWithListener()
 {
     $mockListener = $this->getMockBuilder('RcmLogin\\EventListener\\Login')->disableOriginalConstructor()->getMock();
     $mockServiceManager = $this->getMockBuilder('Zend\\ServiceManager\\ServiceManager')->disableOriginalConstructor()->getMock();
     $mockServiceManager->expects($this->once())->method('get')->with($this->stringContains('RcmLogin\\EventListener\\Login'))->will($this->returnValue($mockListener));
     $mockApplication = $this->getMockBuilder('Zend\\Mvc\\Application')->disableOriginalConstructor()->getMock();
     $mockSharedEventManager = $this->getMockBuilder('Zend\\EventManager\\SharedEventManager')->disableOriginalConstructor()->getMock();
     $mockSharedEventManager->expects($this->once())->method('attach')->with($this->equalTo('RcmLogin\\Controller\\PluginController'), $this->equalTo('LoginSuccessEvent'), $this->equalTo([$mockListener, 'loginSuccess']), $this->equalTo(10000));
     $mockEventManager = $this->getMockBuilder('Zend\\EventManager\\EventManager')->disableOriginalConstructor()->getMock();
     $mockEventManager->expects($this->once())->method('getSharedManager')->will($this->returnValue($mockSharedEventManager));
     $mockApplication->expects($this->any())->method('getServiceManager')->will($this->returnValue($mockServiceManager));
     $mockApplication->expects($this->any())->method('getEventManager')->will($this->returnValue($mockEventManager));
     $mvcEvent = new MvcEvent();
     $mvcEvent->setApplication($mockApplication);
     $module = new Module();
     $result = $module->onBootstrap($mvcEvent);
     $this->assertNull($result);
 }
示例#2
0
 public function testGetConfig()
 {
     $module = new Module();
     $result = $module->getConfig();
     $this->assertTrue(is_array($result), 'Did not return array.');
 }