lithium\tests\cases\console\command\LibraryTest::testPush PHP Method

testPush() public method

public testPush ( )
    public function testPush()
    {
        $this->skipIf(!extension_loaded('zlib'), 'The zlib extension is not loaded.');
        $this->skipIf(ini_get('phar.readonly') == '1', 'Skipped test {:class}::{:function}() - INI setting phar.readonly = On');
        $result = file_put_contents($this->_testPath . '/library_test_plugin/config/library_test_plugin.json', json_encode(array('name' => 'library_test_plugin', 'version' => '1.0', 'summary' => 'something', 'sources' => array('phar' => 'http://somewhere.com/download/library_test_plugin.phar.gz'))));
        $this->assertTrue($result);
        $result = $this->library->archive($this->_testPath . '/library_test_plugin', $this->_testPath . '/library_test_plugin');
        $this->assertTrue($result);
        $expected = "library_test_plugin.phar.gz created in {$this->_testPath} from ";
        $expected .= "{$this->_testPath}/library_test_plugin\n";
        $result = $this->library->response->output;
        $this->assertEqual($expected, $result);
        $result = file_exists($this->_testPath . '/library_test_plugin.phar.gz');
        $this->assertTrue($result);
        $this->library->response->output = null;
        $result = $this->library->push('library_test_plugin');
        $this->assertTrue($result);
        $expected = "library_test_plugin added to {$this->library->server}.\n";
        $expected .= "See http://{$this->library->server}/lab/plugins/view/{$result->id}\n";
        $result = $this->library->response->output;
        $this->assertEqual($expected, $result);
        $result = is_dir($this->_testPath . '/library_test_plugin');
        $this->assertTrue($result);
        $this->_cleanUp('tests/library_test_plugin');
        rmdir($this->_testPath . '/library_test_plugin');
    }