AppserverIo\Appserver\Core\Api\AppServiceTest::testCleanUpFolders PHP Method

testCleanUpFolders() public method

Tests if we are able to clear the tmp directory of an application
public testCleanUpFolders ( ) : null
return null
    public function testCleanUpFolders()
    {
        $cacheDir = $this->getTmpDir() . DIRECTORY_SEPARATOR . 'cache';
        if (!is_dir($cacheDir)) {
            \mkdir($cacheDir);
        }
        touch($cacheDir . DIRECTORY_SEPARATOR . md5(__METHOD__));
        $mockApplication = $this->getMockBuilder('\\AppserverIo\\Psr\\Application\\ApplicationInterface')->setMethods(get_class_methods('\\AppserverIo\\Appserver\\Application\\Application'))->getMock();
        $mockApplication->expects($this->once())->method('getCacheDir')->will($this->returnValue($cacheDir));
        $this->assertCount(3, scandir($cacheDir));
        $this->appService->cleanUpFolders($mockApplication);
        $this->assertCount(2, scandir($cacheDir));
    }