Esempio n. 1
0
 function testExtract()
 {
     if (file_exists(__DIR__ . "/testing")) {
         ZipDeploy::delTree(__DIR__ . "/testing");
     }
     $z = new ZipDeploy();
     $z->setTempDir("tmp");
     $target = $z->createTarget("test")->setKey("hello")->setZipDir("doc")->setTargetDir(__DIR__ . "/testing");
     $_REQUEST["target"] = "test";
     $_REQUEST["key"] = "hello";
     $z->setInputFileName(__DIR__ . "/doc.zip");
     $z->dispatch();
     $this->assertTrue(file_exists(__DIR__ . "/testing"));
     $this->assertTrue(file_exists(__DIR__ . "/testing/hello.txt"));
     file_put_contents(__DIR__ . "/testing/testkeep", "hello");
     $z->dispatch();
     $this->assertFalse(file_exists(__DIR__ . "/testing/testkeep"));
     $target->addKeep("testkeep");
     file_put_contents(__DIR__ . "/testing/testkeep", "hello");
     $z->dispatch();
     $this->assertTrue(file_exists(__DIR__ . "/testing/testkeep"));
     if (file_exists(__DIR__ . "/testing")) {
         ZipDeploy::delTree(__DIR__ . "/testing");
     }
 }