The DHTML files are processed in the scope of the service() method. This gives developers access to all variables in the method's scope as to all members of the servlet.
Author: Tim Wagner (tw@appserver.io)
Inheritance: extends AppserverIo\Psr\Servlet\Http\HttpServlet
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());
 }