1
0
Fork 0

Merge remote-tracking branch 'wilmoore/feature/memory-package-test-refactor'

Conflicts:
	src/Composer/Package/MemoryPackage.php
pull/29/merge
Jordi Boggiano 2011-09-29 00:55:28 +02:00
commit ebe2a25ec6
2 changed files with 50 additions and 12 deletions

View File

@ -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)
{

View File

@ -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);
}
}