AppserverIo\Appserver\Application\ApplicationTest::testInitializeManagers PHP Method

testInitializeManagers() public method

Test if the managers has been initialized successfully.
public testInitializeManagers ( ) : void
return void
    public function testInitializeManagers()
    {
        // initialize the mock logger
        $mockLogger = $this->getMock('Psr\\Log\\LoggerInterface', array('log', 'error', 'warning', 'notice', 'emergency', 'debug', 'info', 'alert', 'critical'));
        // create a mock instance
        $classToMock = 'AppserverIo\\Appserver\\Application\\Interfaces\\ContextInterface';
        $mockInitialContext = $this->getMock($classToMock, get_class_methods($classToMock));
        $mockInitialContext->expects($this->any())->method('getSystemLogger')->will($this->returnValue($mockLogger));
        // inject the mock initial context instance
        $this->application->injectInitialContext($mockInitialContext);
        // create a mock manager configuration
        $classToMock = 'AppserverIo\\Appserver\\Core\\Api\\Node\\ManagerNodeInterface';
        $mockManagerConfiguration = $this->getMock($classToMock, get_class_methods($classToMock));
        $mockManagerConfiguration->expects($this->any())->method('getName')->will($this->returnValue('MockManager'));
        // register the mock manager instance
        $this->application->addManager($mockManager = new MockManager(), $mockManagerConfiguration);
        $this->application->initializeManagers();
        // check that the mock manager has been initialized
        $this->assertTrue($mockManager->isInitialized());
    }