Returns the servers webapps directory.
public getWebappsDir ( AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface $containerNode, string $relativePathToAppend = '' ) : string | ||
$containerNode | AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface | The container to return the temporary directory for |
$relativePathToAppend | string | A relative path to append |
return | string |
/** * Tests if getting just the webapps directory works * * @return null */ public function testGetWebappsDirNothingToAppend() { $mockHost = $this->getMockBuilder('\\AppserverIo\\Appserver\\Core\\Api\\Node\\HostNodeInterface')->setMethods(get_class_methods('\\AppserverIo\\Appserver\\Core\\Api\\Node\\HostNodeInterface'))->getMock(); $mockHost->expects($this->once())->method('getAppBase')->willReturn('webapps'); $mockContainer = $this->getMockBuilder('\\AppserverIo\\Appserver\\Core\\Api\\Node\\ContainerNodeInterface')->setMethods(get_class_methods('\\AppserverIo\\Appserver\\Core\\Api\\Node\\ContainerNodeInterface'))->getMock(); $mockContainer->expects($this->once())->method('getHost')->willReturn($mockHost); $webappsDir = $this->service->getWebappsDir($mockContainer); $this->assertEquals('/opt/appserver/webapps', $webappsDir); $this->assertNotEquals('/opt/appserver/webapps/test/directory', $webappsDir); }
/** * Tests if getting just the webapps directory works * * @return null */ public function testGetWebappsDirNothingToAppend() { $webappsDir = $this->service->getWebappsDir(); $this->assertEquals('/opt/appserver/webapps', $webappsDir); $this->assertNotEquals('/opt/appserver/webapps/test/directory', $webappsDir); }