AppserverIo\Appserver\Application\Application::getInitialContext PHP Method

getInitialContext() public method

Returns the initial context instance.
public getInitialContext ( ) : AppserverIo\Appserver\Application\Interfaces\ContextInterface
return AppserverIo\Appserver\Application\Interfaces\ContextInterface The initial Context
    public function getInitialContext()
    {
        return $this->initialContext;
    }

Usage Example

Example #1
0
 /**
  * Test if the getter/setter for the initial context works.
  *
  * @return void
  */
 public function testInjectGetInitialContext()
 {
     // define the methods to mock
     $methodsToMock = array('getClassLoader', 'newInstance', 'newService', 'getAttribute', 'getSystemLogger', 'getSystemConfiguration', 'getLogger');
     // create a mock instance
     $mockInitialContext = $this->getMock('AppserverIo\\Appserver\\Application\\Interfaces\\ContextInterface', $methodsToMock);
     // check if the passed instance is equal to the getter one
     $this->application->injectInitialContext($mockInitialContext);
     $this->assertEquals($mockInitialContext, $this->application->getInitialContext());
 }