public function testCreateTmpFolders()
{
// temporarily switch off initUmask() and setUserRights() as they would make problems
$service = $this->getMockBuilder('\\AppserverIo\\Appserver\\Core\\Api\\AppService')->setMethods(array_merge(array('findAll', 'load', 'initUmask', 'setUserRights')))->setConstructorArgs(array($this->getMockInitialContext()))->getMockForAbstractClass();
$service->expects($this->any())->method('findAll')->will($this->returnValue(array()));
$service->expects($this->any())->method('load')->will($this->returnValue(null));
$service->expects($this->exactly(3))->method('initUmask');
$service->expects($this->exactly(3))->method('setUserRights');
$tmp = $this->getTmpDir() . DIRECTORY_SEPARATOR;
$tmpDir = $tmp . 'tmp';
$cacheDir = $tmp . 'cache';
$sessionDir = $tmp . 'session';
$mockApplication = $this->getMockBuilder('\\AppserverIo\\Psr\\Application\\ApplicationInterface')->setMethods(get_class_methods('\\AppserverIo\\Appserver\\Application\\Application'))->getMock();
$mockApplication->expects($this->once())->method('getTmpDir')->will($this->returnValue($tmpDir));
$mockApplication->expects($this->once())->method('getCacheDir')->will($this->returnValue($cacheDir));
$mockApplication->expects($this->once())->method('getSessionDir')->will($this->returnValue($sessionDir));
$service->createTmpFolders($mockApplication);
$this->assertTrue(is_dir($tmpDir));
$this->assertTrue(is_dir($cacheDir));
$this->assertTrue(is_dir($sessionDir));
}