public static function getManifest() { // Create the library manifest $manifest = new \GreenCape\Manifest\LibraryManifest(); // Meta data $manifest->setTarget('3.1')->setMethod('install')->setName('Joomla! Platform')->setLibraryName('joomla')->setVersion('12.2')->setDescription('LIB_JOOMLA_XML_DESCRIPTION')->setCreationDate('January 2008')->setCopyright('2005 - 2013', 'Open Source Matters', false)->setLicense('http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL')->setAuthor('Joomla! Project')->setAuthorEmail('*****@*****.**')->setAuthorUrl('http://www.joomla.org')->setPackager('Joomla!')->setPackagerUrl('http://www.joomla.org'); // Front-end files $files = new \GreenCape\Manifest\FileSection(); $files->setBase('libraries')->setFileTag('file')->addFolder('compat')->addFolder('joomla')->addFolder('legacy')->addFile('import.legacy.php')->addFile('import.php')->addFile('loader.php')->addFile('platform.php'); $manifest->addSection('files', $files); return $manifest; }
/** * Issue #9: File manifest: fileset is not supported */ public function testAddFileset() { $this->manifest->setAuthor('Test')->setCreationDate('August 2014')->setCopyright('2014', 'Test', false); $section = new \GreenCape\Manifest\FilesetSection(); $files = new \GreenCape\Manifest\FileSection(); $files->setBase('dir')->addFile('foo.txt'); $section->addFileset($files); $this->manifest->addSection('fileset', $section); $expected = '<?xml version="1.0" encoding="UTF-8"?>'; $expected .= '<extension method="install" type="file" version="2.5">'; $expected .= '<author>Test</author>'; $expected .= '<creationDate>August 2014</creationDate>'; $expected .= '<copyright>(C) 2014 Test. All rights reserved.</copyright>'; $expected .= '<license>GNU General Public License version 2 or later; see LICENSE.txt</license>'; $expected .= '<fileset>'; $expected .= '<files folder="dir">'; $expected .= '<file>foo.txt</file>'; $expected .= '</files>'; $expected .= '</fileset>'; $expected .= '</extension>'; $this->assertXmlStringEqualsXmlString($expected, (string) $this->manifest); }
public function testAttributesDoNotFlowIntoSiblings() { $files = new \GreenCape\Manifest\FileSection(); $files->setBase('site'); $files->addFile('foo.php'); $files->addFolder('bar'); $this->manifest->addSection('files', $files); preg_match_all('~\\<(\\w+)[^>]*folder="site"~sm', (string) $this->manifest, $matches, PREG_SET_ORDER); $this->assertEquals(1, count($matches)); $this->assertEquals('files', $matches[0][1]); }
/** * Issue #9: File manifest: fileset is not supported */ public function testAddMultipleFileSections() { $files = new \GreenCape\Manifest\FileSection(); $files->setBase('dir')->addFile('foo.txt'); $this->section->addFileset($files); $files = new \GreenCape\Manifest\FileSection(); $files->setBase('another/dir')->addFile('bar.txt'); $this->section->addFileset($files); $xml = new \GreenCape\Xml\Converter(array('fileset' => $this->section->getStructure())); $expected = '<?xml version="1.0" encoding="UTF-8"?>'; $expected .= '<fileset>'; $expected .= '<files folder="dir">'; $expected .= '<file>foo.txt</file>'; $expected .= '</files>'; $expected .= '<files folder="another/dir">'; $expected .= '<file>bar.txt</file>'; $expected .= '</files>'; $expected .= '</fileset>'; $this->assertXmlStringEqualsXmlString($expected, (string) $xml); }
public static function getManifest() { // Create the component manifest $manifest = new \GreenCape\Manifest\ComponentManifest(); // Meta data $manifest->setTarget('1.6')->setMethod('upgrade')->setName('com_alpha')->setAuthor('John Doe')->setAuthorEmail('*****@*****.**')->setAuthorUrl('http://www.example.org')->setCopyright(2008, 'Copyright Info', false)->setLicense('License Info')->setVersion('1.0')->setCreationDate('March 2006'); // Installer hooks $manifest->setInstallFile('file.install.php')->setUninstallFile('file.uninstall.php')->setScriptFile('file.script.php'); // SQL files $install = new \GreenCape\Manifest\SqlSection(); $install->addFile('mysql', 'sql/install.mysql.utf8.sql', array('charset' => 'utf8')); $manifest->addSection('install', $install); $uninstall = new \GreenCape\Manifest\SqlSection(); $uninstall->addFile('mysql', 'sql/uninstall.mysql.utf8.sql', array('charset' => 'utf8', 'folder' => 'sql')); $manifest->addSection('uninstall', $uninstall); $update = new \GreenCape\Manifest\SchemaSection(); $update->addFolder('mysql', 'sql/updates/mysql')->addFolder('sqlsrv', 'sql/updates/sqlsrv'); $manifest->addSection('update', $update); // Front-end files $files = new \GreenCape\Manifest\FileSection(); $files->setBase('site')->addFile('alpha.php'); $manifest->addSection('files', $files); // Front-end language (legacy 1.5 support) $language = new \GreenCape\Manifest\LanguageSection(); $language->setBase('site')->addFile('en-GB', 'language/en-GB/en-GB.com_alpha.ini'); $manifest->addSection('languages', $language); // Media Files $media = new \GreenCape\Manifest\MediaSection(); $media->setDestination('com_alpha')->addFile('com_alpha.jpg'); $manifest->addSection('media', $media); // Backend files $menu = new \GreenCape\Manifest\MenuSection(); $menu->setLabel('Alpha')->setIcon('components/com_alpha/applications-internet-16.png')->addMenu('Installer', 'option=com_installer')->addMenu('Users', 'option=com_users'); $adminFiles = new \GreenCape\Manifest\FileSection(); $adminFiles->setBase('admin')->addFile('admin.alpha.php')->addFile('image.png')->addFile('applications-internet.png')->addFile('applications-internet-16.png')->addFolder('sql'); $adminLanguage = new \GreenCape\Manifest\LanguageSection(); $adminLanguage->setBase('admin/language')->addFile('en-GB', 'en-GB/en-GB.com_alpha.ini')->addFile('en-GB', 'en-GB/en-GB.com_alpha.sys.ini'); $admin = new \GreenCape\Manifest\AdminSection(); $admin->setMenu($menu)->setFiles($adminFiles)->setLanguage($adminLanguage); $manifest->addSection('administration', $admin); // Extension Update Specification $server = new \GreenCape\Manifest\ServerSection(); $server->addServer('extension', 'Extension Update Site', 'http://jsitepoint.com/update/components/com_alpha/extension.xml', 1)->addServer('collection', 'Collection Update Site', 'http://jsitepoint.com/update/update.xml', 2); $manifest->addSection('updateservers', $server); // Tables $tables = new \GreenCape\Manifest\TableSection(); $tables->addTable('#__alpha_install')->addTable('#__alpha_update', true); $manifest->addSection('tables', $tables); // Dependencies $dependencies = new \GreenCape\Manifest\DependencySection(); $dependencies->addDependency('platform', 'joomla', '=', '1.5'); $manifest->addSection('dependencies', $dependencies); return $manifest; }