extract() public method

If both parameters exist, then the first will be the template archive and the second will be the name of the extracted archive li3 library extract myapp : uses the command/create/template/app.phar.gz li3 library extract another_archive myapp li3 library extract plugin li3_plugin : uses the command/create/template/plugin.phar.gz
public extract ( string $name = 'new', string $result = null ) : boolean
$name string if only param, command/create/template/app.phar.gz extracted to $name otherwise, the template name or full path to extract `from` phar.gz.
$result string if exists $name is extracted to $result
return boolean
Beispiel #1
0
 public function testExtractWhenLibraryDoesNotExist()
 {
     $this->skipIf(!extension_loaded('zlib'), 'The zlib extension is not loaded.');
     chdir($this->_testPath);
     $app = new Library(array('request' => new Request(), 'classes' => $this->classes));
     $app->library = 'does_not_exist';
     $result = $app->extract();
     $this->assertTrue($result);
     $this->assertTrue(file_exists($this->_testPath . '/new'));
     $path = realpath($this->_testPath);
     $tplPath = realpath(LITHIUM_LIBRARY_PATH . '/lithium/console/command/create/template');
     $expected = "new created in {$path} from {$tplPath}/app.phar.gz\n";
     $result = $app->response->output;
     $this->assertEqual($expected, $result);
     $this->_cleanUp();
 }
Beispiel #2
0
 public function testExtractWhenLibraryDoesNotExist()
 {
     $this->skipIf(!extension_loaded('zlib'), 'The zlib extension is not loaded.');
     chdir($this->_testPath);
     $app = new Library(array('request' => new Request(), 'classes' => $this->classes));
     $app->library = 'does_not_exist';
     $result = $app->extract();
     $this->assertTrue($result);
     $this->assertFileExists($this->_testPath . '/new');
     $path = realpath($this->_testPath);
     $lithium = Libraries::get('lithium', 'path');
     $tplPath = realpath($lithium . '/console/command/create/template');
     $filePath = $tplPath . DIRECTORY_SEPARATOR . "app.phar.gz";
     $expected = "new created in {$path} from {$filePath}\n";
     $result = $app->response->output;
     $this->assertEqual($expected, $result);
     $this->_cleanUp();
 }