2011-04-05 15:37:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2011-04-16 12:42:35 +00:00
|
|
|
* This file is part of Composer.
|
2011-04-05 15:37:19 +00:00
|
|
|
*
|
2011-04-16 12:42:35 +00:00
|
|
|
* (c) Nils Adermann <naderman@naderman.de>
|
|
|
|
* Jordi Boggiano <j.boggiano@seld.be>
|
2011-04-05 15:37:19 +00:00
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
2011-04-17 21:45:37 +00:00
|
|
|
namespace Composer\Test\Package;
|
2011-04-05 15:37:19 +00:00
|
|
|
|
2011-04-17 21:45:37 +00:00
|
|
|
use Composer\Package\MemoryPackage;
|
2011-04-05 15:37:19 +00:00
|
|
|
|
2011-04-18 20:42:23 +00:00
|
|
|
class MemoryPackageTest extends \PHPUnit_Framework_TestCase
|
2011-04-05 15:37:19 +00:00
|
|
|
{
|
2011-09-27 04:05:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Memory package naming, versioning, and marshalling semantics provider
|
|
|
|
*
|
|
|
|
* demonstrates several versioning schemes
|
|
|
|
*/
|
2011-09-28 03:32:36 +00:00
|
|
|
public function ProviderVersioningSchemes()
|
2011-09-27 04:05:57 +00:00
|
|
|
{
|
|
|
|
$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');
|
|
|
|
|
|
|
|
return $provider;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests memory package naming semantics
|
|
|
|
*
|
2011-09-28 03:32:36 +00:00
|
|
|
* @dataProvider ProviderVersioningSchemes
|
2011-09-28 03:36:55 +00:00
|
|
|
*
|
|
|
|
* @param string $name
|
|
|
|
* @param string $version
|
2011-09-27 04:05:57 +00:00
|
|
|
*/
|
2011-09-28 03:36:55 +00:00
|
|
|
public function testMemoryPackageHasExpectedNamingSemantics($name, $version)
|
2011-04-05 15:37:19 +00:00
|
|
|
{
|
2011-09-27 04:05:57 +00:00
|
|
|
$package = new MemoryPackage($name, $version);
|
|
|
|
$this->assertEquals(strtolower($name), $package->getName());
|
|
|
|
}
|
2011-04-05 15:37:19 +00:00
|
|
|
|
2011-09-27 04:05:57 +00:00
|
|
|
/**
|
|
|
|
* Tests memory package versioning semantics
|
|
|
|
*
|
2011-09-28 03:32:36 +00:00
|
|
|
* @dataProvider ProviderVersioningSchemes
|
2011-09-28 03:36:55 +00:00
|
|
|
*
|
|
|
|
* @param string $name
|
|
|
|
* @param string $version
|
2011-09-27 04:05:57 +00:00
|
|
|
*/
|
2011-09-28 03:36:55 +00:00
|
|
|
public function testMemoryPackageHasExpectedVersioningSemantics($name, $version)
|
2011-09-27 04:05:57 +00:00
|
|
|
{
|
|
|
|
$package = new MemoryPackage($name, $version);
|
|
|
|
$this->assertEquals($version, $package->getVersion());
|
|
|
|
}
|
2011-04-05 15:37:19 +00:00
|
|
|
|
2011-09-27 04:05:57 +00:00
|
|
|
/**
|
|
|
|
* Tests memory package marshalling/serialization semantics
|
|
|
|
*
|
2011-09-28 03:32:36 +00:00
|
|
|
* @dataProvider ProviderVersioningSchemes
|
2011-09-28 03:36:55 +00:00
|
|
|
*
|
|
|
|
* @param string $name
|
|
|
|
* @param string $version
|
|
|
|
* @param string $marshalled
|
2011-09-27 04:05:57 +00:00
|
|
|
*/
|
2011-09-28 03:32:36 +00:00
|
|
|
public function testMemoryPackageHasExpectedMarshallingSemantics($name, $version, $marshalled)
|
2011-09-27 04:05:57 +00:00
|
|
|
{
|
|
|
|
$package = new MemoryPackage($name, $version);
|
|
|
|
$this->assertEquals($marshalled, (string) $package);
|
2011-04-05 15:37:19 +00:00
|
|
|
}
|
2011-09-27 04:05:57 +00:00
|
|
|
|
2011-04-05 15:37:19 +00:00
|
|
|
}
|