Пример #1
0
 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();
 }
Пример #2
0
 function testNewTempFile()
 {
     $d = new Dir("/test/tmp_dir/");
     File::setTmpFileDir($d);
     $this->assertEquals($d->getFullPath(), File::getTmpFileDir()->getFullPath(), "La directory dei file temporanei non è stata impostata correttamente!!");
     $tmp_file = File::newTempFile();
     $tmp_file->setContent("Hello!");
     $this->assertEquals("Hello!", $tmp_file->getContent(), "Il contenuto salvato nel file temporaneo non corrisponde!!");
     $tmp_file->delete();
 }