mirror of
https://github.com/composer/composer
synced 2025-05-10 17:12:51 +00:00
Moving rule iteration logic to a separate RuleSet and RuleSetIterator class
This commit is contained in:
parent
26d62640a7
commit
bc672deb32
5 changed files with 452 additions and 114 deletions
44
tests/Composer/Test/DependencyResolver/RuleSetTest.php
Normal file
44
tests/Composer/Test/DependencyResolver/RuleSetTest.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Test\DependencyResolver;
|
||||
|
||||
use Composer\DependencyResolver\Rule;
|
||||
use Composer\DependencyResolver\RuleSet;
|
||||
|
||||
class RuleSetTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testAdd()
|
||||
{
|
||||
$rules = array(
|
||||
RuleSet::TYPE_PACKAGE => array(),
|
||||
RuleSet::TYPE_JOB => array(
|
||||
new Rule(array(), 'job1', null),
|
||||
new Rule(array(), 'job2', null),
|
||||
),
|
||||
RuleSet::TYPE_UPDATE => array(
|
||||
new Rule(array(), 'update1', null),
|
||||
),
|
||||
RuleSet::TYPE_FEATURE => array(),
|
||||
RuleSet::TYPE_WEAK => array(),
|
||||
RuleSet::TYPE_LEARNED => array(),
|
||||
);
|
||||
|
||||
$ruleSet = new RuleSet;
|
||||
|
||||
$ruleSet->add($rules[RuleSet::TYPE_JOB][0], RuleSet::TYPE_JOB);
|
||||
$ruleSet->add($rules[RuleSet::TYPE_UPDATE][0], RuleSet::TYPE_UPDATE);
|
||||
$ruleSet->add($rules[RuleSet::TYPE_JOB][1], RuleSet::TYPE_JOB);
|
||||
|
||||
$this->assertEquals($rules, $ruleSet->getRules());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue