/** * Test the main conversion values. * * @return void */ public function testFull() { $package = new RootPackage('test/package', '0.1.1.1', '0.1.1.1'); $package->setType('project'); $package->setLicense(['LGPL-3']); $package->setType('project'); $package->setReleaseDate($time = new \DateTime()); $package->setDescription('Descriptiontext'); $package->setKeywords(['keyword1', 'keyword1']); $package->setHomepage('https://example.org'); $package->setAuthors([['name' => 'A. Coder', 'email' => '*****@*****.**'], ['name' => 'A. Nother. Coder', 'email' => '*****@*****.**']]); $package->setSupport(['issues' => 'https://example.org/issue-tracker']); $package->setAbandoned('another/package'); $converted = PackageConverter::create($package)->convertPackageToArray($package, '1.1.1.1'); $this->assertEquals(['name', 'version', 'constraint', 'type', 'locked', 'time', 'upgrade_version', 'description', 'license', 'keywords', 'homepage', 'authors', 'support', 'abandoned', 'replacement'], $converted->getEntries('/')); $this->assertEquals($package->getName(), $converted->get('name')); $this->assertEquals($package->getPrettyVersion(), $converted->get('version')); $this->assertNull($converted->get('constraint')); $this->assertEquals($package->getType(), $converted->get('type')); $this->assertFalse($converted->get('locked')); $this->assertEquals($package->getLicense(), $converted->get('license')); $this->assertEquals($time->format(\DateTime::ATOM), $converted->get('time')); $this->assertEquals('1.1.1.1', $converted->get('upgrade_version')); $this->assertEquals($package->getDescription(), $converted->get('description')); $this->assertEquals($package->getKeywords(), $converted->get('keywords')); $this->assertEquals($package->getHomepage(), $converted->get('homepage')); $this->assertEquals($package->getAuthors(), $converted->get('authors')); $this->assertEquals($package->getSupport(), $converted->get('support')); $this->assertEquals($package->isAbandoned(), $converted->get('abandoned')); $this->assertEquals($package->getReplacementPackage(), $converted->get('replacement')); }