Пример #1
0
 /**
     @test
 */
 function testBlackHole()
 {
     $f = new File("/test/BlackHoleTest.php");
     $this->assertTrue($f->exists(), "Il file del test non esiste!!");
     $content = $f->getContent();
     $f->delete();
     $this->assertFalse($f->exists(), "Il file del test black hole non e' stato eliminato!!");
     $f->touch();
     $f->setContent($content);
     $this->assertTrue($f->exists(), "Il file del test black hole non e' stato rigenerato!!");
 }
Пример #2
0
 function testAddEntriesToFile()
 {
     $file = new File("/test/java_xml_properties_dir/test_folder_2/add_props.xml");
     if ($file->exists()) {
         $file->delete();
     }
     JavaXmlPropertiesUtils::addEntriesToFile($file, array("ciao" => 1, "mondo" => 2, 3 => "pluto"));
     $this->assertTrue($file->exists(), "Il file delle properties non è stato creato!!");
     $props = JavaXmlPropertiesUtils::readFromFile($file);
     $this->assertTrue(count($props) == 3, "Il numero delle properties non corrisponde!");
     $this->assertEquals($props["ciao"], 1);
     $this->assertEquals($props["mondo"], 2);
     $this->assertEquals($props[3], "pluto");
     $file->delete();
 }
Пример #3
0
 function testaddEntriesToFile()
 {
     $file = new File("/test/properties_dir/test_folder_2/add_props.ini");
     if ($file->exists()) {
         $file->delete();
     }
     IniPropertiesUtils::addEntriesToFile($file, true, array("prova" => array("ciao" => 1, "mondo" => 2, 3 => "pluto")));
     $this->assertTrue($file->exists(), "Il file delle properties non è stato creato!!");
     $props = IniPropertiesUtils::readFromFile($file, true);
     $this->assertTrue(count($props) == 1, "Il numero delle properties non corrisponde!");
     $entry = $props["prova"];
     $this->assertTrue(count($entry) == 3, "Il numero delle voci non corrisponde!");
     $this->assertEquals($entry["ciao"], 1);
     $this->assertEquals($entry["mondo"], 2);
     $this->assertEquals($entry[3], "pluto");
     $file->delete();
 }
Пример #4
0
 function testWriteAndTruncate()
 {
     $f = new File("/test/reader_writer/test_truncate.txt");
     $w = $f->openWriter();
     $w->write("abcdefghij");
     $w->write("1234567890");
     $this->assertEquals($f->getSize(), 20, "La dimensione del file non corrisponde!!");
     $w->truncate(10);
     $this->assertEquals($f->getSize(), 10, "La dimensione del file non corrisponde!!");
     $w->close();
     $r = $f->openReader();
     $st = $r->read(10);
     $this->assertEquals("abcdefghij", $st, "La stringa letta dopo la scrittura non corridponde!!");
     $r->close();
     $f->delete();
 }
Пример #5
0
 function testCopyFileWithDifficultName()
 {
     $f = new File("test/difficult_names/src/00 - Época\\ Porteño.txt");
     $d = new Dir("test/difficult_names/dest/");
     $f->copy($d);
     $copied = new File("test/difficult_names/dest/00 - Época\\ Porteño.txt");
     $this->assertTrue($copied->exists(), "Il file non è stato copiato correttamente!");
     $copied->delete();
     $this->assertFalse($copied->exists(), "Il file non è stato eliminato correttamente!");
 }