function testExceptionAfterCloseOnWrite() { File::setTmpFileDir("/test/tmp_dir/"); $f = File::newTempFile(); $fw = $f->openWriter(); $this->assertTrue($fw->isOpen(), "Il file temporaneo non risulta aperto!!"); $fw->writeln("Ciao, questo e' un file temporaneo..."); $fw->reset(); $fw->close(); try { $fw->writeln("Ciao!!"); $this->fail(); } catch (IOException $ex) { } $f->delete(); }
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(); }