Author: Tim Wagner (tw@appserver.io)
Inheritance: extends AppserverIo\Appserver\Core\Api\AbstractFileOperationService
Esempio n. 1
0
 /**
  * Tests if we are able to clear the tmp directory of an application
  *
  * @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));
 }