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

testRegisterClassLoaders() public method

Test if the class loaders has been registered successfully.
public testRegisterClassLoaders ( ) : void
return void
    public function testRegisterClassLoaders()
    {
        // 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 loader configuration
        $classToMock = 'AppserverIo\\Appserver\\Core\\Api\\Node\\ClassLoaderNodeInterface';
        $mockLoaderConfiguration = $this->getMock($classToMock, get_class_methods($classToMock));
        $mockLoaderConfiguration->expects($this->any())->method('getName')->will($this->returnValue('MockLoader'));
        // register the mock class loader instance
        $this->application->addClassLoader($mockClassLoader = new MockClassLoader(), $mockLoaderConfiguration);
        $this->application->registerClassLoaders();
        // check that the mock class loader has been registered
        $this->assertTrue($mockClassLoader->isRegistered());
    }