AppserverIo\Appserver\ServletEngine\Servlets\DhtmlServlet::getWebappPath PHP Method

getWebappPath() public method

Returns the path to the web application.
public getWebappPath ( ) : string
return string The path to the web application
    public function getWebappPath()
    {
        return $this->webappPath;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Tests the servlets init() method.
  *
  * @return void
  */
 public function testInit()
 {
     // create a servlet config mock instance
     $mockServletConfig = $this->getMockBuilder($servletConfigInterface = 'AppserverIo\\Psr\\Servlet\\ServletConfigInterface')->setMethods(get_class_methods($servletConfigInterface))->getMock();
     // mock the necessary method
     $mockServletConfig->expects($this->once())->method('getWebappPath')->will($this->returnValue($webappPath = '/opt/appserver/webapps/test'));
     // create and initialize a servlet instance
     $servlet = new DhtmlServlet();
     $servlet->init($mockServletConfig);
     // check that the servlet has been initilized successfully
     $this->assertSame($webappPath, $servlet->getWebappPath());
     $this->assertSame(get_class($servlet), $servlet->getPoweredBy());
 }