1
0
Fork 0

Complete the policy tests with provider and replacement tests

pull/60/merge
Nils Adermann 2011-10-21 14:58:31 +02:00
parent e4c94dd415
commit 0c30610fdc
1 changed files with 39 additions and 0 deletions

View File

@ -98,4 +98,43 @@ class DefaultPolicyTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected, $selected);
}
public function testSelectAllProviders()
{
$this->markTestIncomplete();
$this->repo->addPackage($packageA = new MemoryPackage('A', '1.0'));
$this->repo->addPackage($packageB = new MemoryPackage('B', '2.0'));
$packageA->setProvides(array(new Link('A', 'X', new VersionConstraint('==', '1.0'), 'provides')));
$packageB->setProvides(array(new Link('B', 'X', new VersionConstraint('==', '1.0'), 'provides')));
$this->pool->addRepository($this->repo);
$literals = array(new Literal($packageA, true), new Literal($packageB, true));
$expected = $literals;
$selected = $this->policy->selectPreferedPackages($this->pool, $this->repoInstalled, $literals);
$this->assertEquals($expected, $selected);
}
public function testSelectNonReplacingFromSameRepo()
{
$this->markTestIncomplete();
$this->repo->addPackage($packageA = new MemoryPackage('A', '1.0'));
$this->repo->addPackage($packageB = new MemoryPackage('B', '2.0'));
$packageB->setReplaces(array(new Link('B', 'A', new VersionConstraint('==', '1.0'), 'replaces')));
$this->pool->addRepository($this->repo);
$literals = array(new Literal($packageA, true), new Literal($packageB, true));
$expected = array(new Literal($packageA, true));
$selected = $this->policy->selectPreferedPackages($this->pool, $this->repoInstalled, $literals);
$this->assertEquals($expected, $selected);
}
}