diff --git a/src/Composer/Package/MemoryPackage.php b/src/Composer/Package/MemoryPackage.php index eb9f644fd..325403f91 100644 --- a/src/Composer/Package/MemoryPackage.php +++ b/src/Composer/Package/MemoryPackage.php @@ -92,7 +92,7 @@ class MemoryPackage extends BasePackage */ public function setInstallationSource($type) { - $this-> installationSource = $type; + $this->installationSource = $type; } /** @@ -200,7 +200,7 @@ class MemoryPackage extends BasePackage } /** - * @param string $url + * @param string $sha1checksum */ public function setDistSha1Checksum($sha1checksum) { @@ -308,7 +308,7 @@ class MemoryPackage extends BasePackage /** * Set the provided virtual packages * - * @param array $conflicts A set of package links + * @param array $provides A set of package links */ public function setProvides(array $provides) { @@ -326,7 +326,7 @@ class MemoryPackage extends BasePackage /** * Set the packages this one replaces * - * @param array $conflicts A set of package links + * @param array $replaces A set of package links */ public function setReplaces(array $replaces) { @@ -344,7 +344,7 @@ class MemoryPackage extends BasePackage /** * Set the recommended packages * - * @param array $conflicts A set of package links + * @param array $recommends A set of package links */ public function setRecommends(array $recommends) { @@ -362,7 +362,7 @@ class MemoryPackage extends BasePackage /** * Set the suggested packages * - * @param array $conflicts A set of package links + * @param array $suggests A set of package links */ public function setSuggests(array $suggests) { diff --git a/tests/Composer/Test/Package/MemoryPackageTest.php b/tests/Composer/Test/Package/MemoryPackageTest.php index d61e97987..7821185f3 100644 --- a/tests/Composer/Test/Package/MemoryPackageTest.php +++ b/tests/Composer/Test/Package/MemoryPackageTest.php @@ -16,13 +16,51 @@ use Composer\Package\MemoryPackage; class MemoryPackageTest extends \PHPUnit_Framework_TestCase { - public function testMemoryPackage() + + /** + * Memory package naming, versioning, and marshalling semantics provider + * + * demonstrates several versioning schemes + */ + public function providerVersioningSchemes() { - $package = new MemoryPackage('foo', '1-beta'); + $provider[] = array('foo', '1-beta', 'foo-1-beta'); + $provider[] = array('node', '0.5.6', 'node-0.5.6'); + $provider[] = array('li3', '0.10', 'li3-0.10'); + $provider[] = array('mongodb_odm', '1.0.0BETA3', 'mongodb_odm-1.0.0BETA3'); + $provider[] = array('DoctrineCommon', '2.2.0-DEV', 'doctrinecommon-2.2.0-DEV'); - $this->assertEquals('foo', $package->getName()); - $this->assertEquals('1-beta', $package->getVersion()); - - $this->assertEquals('foo-1-beta', (string) $package); + return $provider; } + + /** + * Tests memory package naming semantics + * @dataProvider providerVersioningSchemes + */ + public function testMemoryPackageHasExpectedNamingSemantics($name, $version) + { + $package = new MemoryPackage($name, $version); + $this->assertEquals(strtolower($name), $package->getName()); + } + + /** + * Tests memory package versioning semantics + * @dataProvider providerVersioningSchemes + */ + public function testMemoryPackageHasExpectedVersioningSemantics($name, $version) + { + $package = new MemoryPackage($name, $version); + $this->assertEquals($version, $package->getVersion()); + } + + /** + * Tests memory package marshalling/serialization semantics + * @dataProvider providerVersioningSchemes + */ + public function testMemoryPackageHasExpectedMarshallingSemantics($name, $version, $marshalled) + { + $package = new MemoryPackage($name, $version); + $this->assertEquals($marshalled, (string) $package); + } + }