1
0
Fork 0

Fix tests and invalid use statements

pull/1/head
Jordi Boggiano 2011-04-17 23:45:37 +02:00
parent 3da43e751d
commit c6321e7277
9 changed files with 20 additions and 22 deletions

View File

@ -12,6 +12,8 @@
namespace Composer\DependencyResolver;
use Composer\Package\PackageInterface;
/**
* @author Nils Adermann <naderman@naderman.de>
*/
@ -19,7 +21,7 @@ class Literal
{
protected $wanted;
public function __construct(Package $package, $wanted)
public function __construct(PackageInterface $package, $wanted)
{
$this->package = $package;
$this->wanted = $wanted;

View File

@ -13,6 +13,7 @@
namespace Composer\DependencyResolver;
use Composer\DependencyResolver\RelationConstraint\RelationConstraintInterface;
use Composer\Repository\RepositoryInterface;
/**
* A package pool contains repositories that provide packages.
@ -35,13 +36,9 @@ class Pool
$this->repositories[] = $repo;
foreach ($repo->getPackages() as $package) {
$this->packages[$package->getId()] = $package;
$this->packages[] = $package;
foreach ($package->getNames() as $name) {
if (!isset($this->packageByName[$name])) {
$this->packageByNameByName[$name] = array();
}
$this->packageByName[$name][] = $package;
}
}

View File

@ -13,7 +13,7 @@
namespace Composer\Package;
use Composer\DependencyResolver\RelationConstraint\RelationConstraintInterface;
use Composer\DependencyResolver\RepositoryInterface;
use Composer\Repository\RepositoryInterface;
/**
* Base class for packages providing name storage and default match implementation

View File

@ -13,7 +13,7 @@
namespace Composer\Package;
use Composer\DependencyResolver\RelationConstraint\RelationConstraintInterface;
use Composer\DependencyResolver\RepositoryInterface;
use Composer\Repository\RepositoryInterface;
/**
* @author Nils Adermann <naderman@naderman.de>
@ -59,14 +59,14 @@ interface PackageInterface
*
* @return string The repository type
*/
function getRepositoryType();
function getSourceType();
/**
* Returns the repository url of this package, e.g. git://github.com/naderman/composer.git
*
* @return string The repository url
*/
function getRepositoryUrl();
function getSourceUrl();
/**
* Returns the release type of this package, e.g. stable or beta

View File

@ -13,7 +13,7 @@
namespace Composer\Test\DependencyResolver;
use Composer\DependencyResolver\Literal;
use Composer\DependencyResolver\MemoryPackage;
use Composer\Package\MemoryPackage;
class SolvableTest extends \PHPUnit_Framework_TestCase
{

View File

@ -13,8 +13,8 @@
namespace Composer\Test\DependencyResolver;
use Composer\DependencyResolver\Pool;
use Composer\DependencyResolver\ArrayRepository;
use Composer\DependencyResolver\MemoryPackage;
use Composer\Repository\ArrayRepository;
use Composer\Package\MemoryPackage;
class PoolTest extends \PHPUnit_Framework_TestCase
{

View File

@ -14,9 +14,9 @@ namespace Composer\Test\DependencyResolver;
use Composer\DependencyResolver\Request;
use Composer\DependencyResolver\Pool;
use Composer\DependencyResolver\ArrayRepository;
use Composer\Repository\ArrayRepository;
use Composer\DependencyResolver\Literal;
use Composer\DependencyResolver\MemoryPackage;
use Composer\Package\MemoryPackage;
class RequestTest extends \PHPUnit_Framework_TestCase
{

View File

@ -10,20 +10,19 @@
* file that was distributed with this source code.
*/
namespace Composer\Test\DependencyResolver;
namespace Composer\Test\Package;
use Composer\DependencyResolver\MemoryPackage;
use Composer\Package\MemoryPackage;
class PackageTest extends \PHPUnit_Framework_TestCase
{
public function testPackage()
{
$package = new MemoryPackage('foo', '1', 'beta', 21);
$package = new MemoryPackage('foo', '1', 'beta');
$this->assertEquals('foo', $package->getName());
$this->assertEquals('1', $package->getVersion());
$this->assertEquals('beta', $package->getReleaseType());
$this->assertEquals(21, $package->getId());
$this->assertEquals('foo-beta-1', (string) $package);
}

View File

@ -10,10 +10,10 @@
* file that was distributed with this source code.
*/
namespace Composer\Test\DependencyResolver;
namespace Composer\Test\Repository;
use Composer\DependencyResolver\ArrayRepository;
use Composer\DependencyResolver\MemoryPackage;
use Composer\Repository\ArrayRepository;
use Composer\Package\MemoryPackage;
class ArrayRepositoryTest extends \PHPUnit_Framework_TestCase
{