示例#1
0
 /**
  * Read the package metadata for the given package from the
  * Package.xml file contained in the package
  *
  * @param \TYPO3\FLOW3\Package\PackageInterface $package The package to read metadata for
  * @return \TYPO3\FLOW3\Package\MetaData A package meta data instance with the data from the package's Package.xml file.
  */
 public static function readPackageMetaData(\TYPO3\FLOW3\Package\PackageInterface $package)
 {
     $packageInfoPath = $package->getMetaPath();
     $meta = new \TYPO3\FLOW3\Package\MetaData($package->getPackageKey());
     $xml = simplexml_load_file(\TYPO3\FLOW3\Utility\Files::concatenatePaths(array($packageInfoPath, 'Package.xml')));
     if ($xml === FALSE) {
         $meta->setDescription('[Package.xml could not be read.]');
     } else {
         $meta->setVersion((string) $xml->version);
         $meta->setTitle((string) $xml->title);
         $meta->setDescription((string) $xml->description);
         self::readCategories($xml, $meta);
         self::readParties($xml, $meta);
         self::readConstraints($xml, $meta);
     }
     return $meta;
 }
示例#2
0
 /**
  * @test
  */
 public function testWritePackageMetaDataCreatesXml()
 {
     $packageMetaDataPath = \vfsStream::url('testDirectory') . '/';
     $mockPackage = $this->getMock('TYPO3\\FLOW3\\Package\\PackageInterface');
     $mockPackage->expects($this->once())->method('getMetaPath')->will($this->returnValue($packageMetaDataPath));
     $meta = new \TYPO3\FLOW3\Package\MetaData('Acme.YetAnotherTestPackage');
     $meta->setTitle('Yet another test package');
     $meta->setDescription('A test package to test the creation of the Package.xml by the Package Manager');
     $meta->setVersion('0.1.1');
     $meta->addCategory('Testing');
     $meta->addCategory('System');
     $meta->addParty(new \TYPO3\FLOW3\Package\MetaData\Person('LeadDeveloper', 'Robert Lemke', '*****@*****.**', 'http://www.flow3.org', 'TYPO3 Association', 'robert'));
     $meta->addParty(new \TYPO3\FLOW3\Package\MetaData\Company(null, 'Acme Inc.', '*****@*****.**', 'http://www.acme.com'));
     $meta->addConstraint(new \TYPO3\FLOW3\Package\MetaData\PackageConstraint('depends', 'TYPO3.FLOW3', '1.0.0', '1.9.9'));
     $meta->addConstraint(new \TYPO3\FLOW3\Package\MetaData\SystemConstraint('depends', 'PHP', NULL, '5.3.0'));
     $meta->addConstraint(new \TYPO3\FLOW3\Package\MetaData\SystemConstraint('suggests', 'Memory', '16M'));
     $metaWriter = new \TYPO3\FLOW3\Package\MetaData\XmlWriter();
     $metaWriter->writePackageMetaData($mockPackage, $meta);
     $this->assertXmlFileEqualsXmlFile($packageMetaDataPath . 'Package.xml', __DIR__ . '/../Fixtures/XmlWriterTest/Package.xml');
 }
示例#3
0
 /**
  * @test
  */
 public function createPackageWritesAPackageMetaFileUsingTheGivenMetaObject()
 {
     $metaData = new \TYPO3\FLOW3\Package\MetaData('Acme.YetAnotherTestPackage');
     $metaData->setTitle('Yet Another Test Package');
     $package = $this->packageManager->createPackage('Acme.YetAnotherTestPackage', $metaData);
     $actualPackageXml = simplexml_load_file($package->getMetaPath() . 'Package.xml');
     $this->assertEquals('Acme.YetAnotherTestPackage', (string) $actualPackageXml->key);
     $this->assertEquals('Yet Another Test Package', (string) $actualPackageXml->title);
 }