function testPermissionsOnDir() { $d = new Dir("/test/permissions_test/dir_0/"); $d->touch(); $do_permissions_tests = $d->setPermissions("r--------"); if ($do_permissions_tests) { $this->assertEquals("r--------", $d->getPermissions(), "I permessi non sono stati impostati correttamente sulla cartella!!"); } $d->setPermissions("rwx------"); $d->delete(); $this->assertFalse($d->exists(), "La directory dir_0 non è stata cancellata!!"); $d = new Dir("/test/permissions_test/dir_1/"); $d->touch(); $do_permissions_tests = $d->setPermissions("rw-------"); if ($do_permissions_tests) { $this->assertEquals("rw-------", $d->getPermissions(), "I permessi non sono stati impostati correttamente sulla cartella!!"); } $d->setPermissions("rwx------"); $d->delete(); $this->assertFalse($d->exists(), "La directory dir_1 non è stata cancellata!!"); $d = new Dir("/test/permissions_test/dir_2/"); $d->touch(); $do_permissions_tests = $d->setPermissions("rwx------"); if ($do_permissions_tests) { $this->assertEquals("rwx------", $d->getPermissions(), "I permessi non sono stati impostati correttamente sulla cartella!!"); } $d->setPermissions("rwx------"); $d->delete(); $this->assertFalse($d->exists(), "La directory dir_2 non è stata cancellata!!"); }
function testNewTempFileNonWritableDir() { $d = new Dir("/test/tmp_dir_no_w/"); $d->touch(); $d->setPermissions("r--------"); try { File::setTmpFileDir($d); $this->fail("Using a non-writable directory as temporary dir should throw an Exception."); } catch (IOException $ex) { } $d->delete(); }