Rules of type feature are no longer needed
parent
d153ab3f8f
commit
f4d5568937
|
@ -20,13 +20,11 @@ class RuleSet implements \IteratorAggregate, \Countable
|
|||
// highest priority => lowest number
|
||||
const TYPE_PACKAGE = 0;
|
||||
const TYPE_JOB = 1;
|
||||
const TYPE_FEATURE = 3;
|
||||
const TYPE_LEARNED = 4;
|
||||
|
||||
protected static $types = array(
|
||||
-1 => 'UNKNOWN',
|
||||
self::TYPE_PACKAGE => 'PACKAGE',
|
||||
self::TYPE_FEATURE => 'FEATURE',
|
||||
self::TYPE_JOB => 'JOB',
|
||||
self::TYPE_LEARNED => 'LEARNED',
|
||||
);
|
||||
|
|
|
@ -427,7 +427,7 @@ class Solver
|
|||
|
||||
// push all of our rules (can only be feature or job rules)
|
||||
// asserting this literal on the problem stack
|
||||
foreach ($this->rules->getIteratorFor(array(RuleSet::TYPE_JOB, RuleSet::TYPE_FEATURE)) as $assertRule) {
|
||||
foreach ($this->rules->getIteratorFor(RuleSet::TYPE_JOB) as $assertRule) {
|
||||
if ($assertRule->isDisabled() || !$assertRule->isAssertion() || $assertRule->isWeak()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class ResultSetIteratorTest extends \PHPUnit_Framework_TestCase
|
|||
new Rule(array(), 'job1', null),
|
||||
new Rule(array(), 'job2', null),
|
||||
),
|
||||
RuleSet::TYPE_FEATURE => array(
|
||||
RuleSet::TYPE_LEARNED => array(
|
||||
new Rule(array(), 'update1', null),
|
||||
),
|
||||
RuleSet::TYPE_PACKAGE => array(),
|
||||
|
@ -46,7 +46,7 @@ class ResultSetIteratorTest extends \PHPUnit_Framework_TestCase
|
|||
$expected = array(
|
||||
$this->rules[RuleSet::TYPE_JOB][0],
|
||||
$this->rules[RuleSet::TYPE_JOB][1],
|
||||
$this->rules[RuleSet::TYPE_FEATURE][0],
|
||||
$this->rules[RuleSet::TYPE_LEARNED][0],
|
||||
);
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
|
@ -64,7 +64,7 @@ class ResultSetIteratorTest extends \PHPUnit_Framework_TestCase
|
|||
$expected = array(
|
||||
RuleSet::TYPE_JOB,
|
||||
RuleSet::TYPE_JOB,
|
||||
RuleSet::TYPE_FEATURE,
|
||||
RuleSet::TYPE_LEARNED,
|
||||
);
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
|
|
|
@ -27,16 +27,15 @@ class RuleSetTest extends TestCase
|
|||
new Rule(array(), 'job1', null),
|
||||
new Rule(array(), 'job2', null),
|
||||
),
|
||||
RuleSet::TYPE_FEATURE => array(
|
||||
RuleSet::TYPE_LEARNED => array(
|
||||
new Rule(array(), 'update1', null),
|
||||
),
|
||||
RuleSet::TYPE_LEARNED => array(),
|
||||
);
|
||||
|
||||
$ruleSet = new RuleSet;
|
||||
|
||||
$ruleSet->add($rules[RuleSet::TYPE_JOB][0], RuleSet::TYPE_JOB);
|
||||
$ruleSet->add($rules[RuleSet::TYPE_FEATURE][0], RuleSet::TYPE_FEATURE);
|
||||
$ruleSet->add($rules[RuleSet::TYPE_LEARNED][0], RuleSet::TYPE_LEARNED);
|
||||
$ruleSet->add($rules[RuleSet::TYPE_JOB][1], RuleSet::TYPE_JOB);
|
||||
|
||||
$this->assertEquals($rules, $ruleSet->getRules());
|
||||
|
@ -79,7 +78,7 @@ class RuleSetTest extends TestCase
|
|||
$rule1 = new Rule(array(), 'job1', null);
|
||||
$rule2 = new Rule(array(), 'job1', null);
|
||||
$ruleSet->add($rule1, RuleSet::TYPE_JOB);
|
||||
$ruleSet->add($rule2, RuleSet::TYPE_FEATURE);
|
||||
$ruleSet->add($rule2, RuleSet::TYPE_LEARNED);
|
||||
|
||||
$iterator = $ruleSet->getIterator();
|
||||
|
||||
|
@ -95,9 +94,9 @@ class RuleSetTest extends TestCase
|
|||
$rule2 = new Rule(array(), 'job1', null);
|
||||
|
||||
$ruleSet->add($rule1, RuleSet::TYPE_JOB);
|
||||
$ruleSet->add($rule2, RuleSet::TYPE_FEATURE);
|
||||
$ruleSet->add($rule2, RuleSet::TYPE_LEARNED);
|
||||
|
||||
$iterator = $ruleSet->getIteratorFor(RuleSet::TYPE_FEATURE);
|
||||
$iterator = $ruleSet->getIteratorFor(RuleSet::TYPE_LEARNED);
|
||||
|
||||
$this->assertSame($rule2, $iterator->current());
|
||||
}
|
||||
|
@ -109,7 +108,7 @@ class RuleSetTest extends TestCase
|
|||
$rule2 = new Rule(array(), 'job1', null);
|
||||
|
||||
$ruleSet->add($rule1, RuleSet::TYPE_JOB);
|
||||
$ruleSet->add($rule2, RuleSet::TYPE_FEATURE);
|
||||
$ruleSet->add($rule2, RuleSet::TYPE_LEARNED);
|
||||
|
||||
$iterator = $ruleSet->getIteratorWithout(RuleSet::TYPE_JOB);
|
||||
|
||||
|
@ -141,7 +140,7 @@ class RuleSetTest extends TestCase
|
|||
->method('equal')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$ruleSet->add($rule, RuleSet::TYPE_FEATURE);
|
||||
$ruleSet->add($rule, RuleSet::TYPE_LEARNED);
|
||||
|
||||
$this->assertTrue($ruleSet->containsEqual($rule));
|
||||
$this->assertFalse($ruleSet->containsEqual($rule2));
|
||||
|
@ -154,9 +153,9 @@ class RuleSetTest extends TestCase
|
|||
$literal = new Literal($this->getPackage('foo', '2.1'), true);
|
||||
$rule = new Rule(array($literal), 'job1', null);
|
||||
|
||||
$ruleSet->add($rule, RuleSet::TYPE_FEATURE);
|
||||
$ruleSet->add($rule, RuleSet::TYPE_JOB);
|
||||
|
||||
$this->assertContains('FEATURE : (+foo-2.1.0.0)', $ruleSet->__toString());
|
||||
$this->assertContains('JOB : (+foo-2.1.0.0)', $ruleSet->__toString());
|
||||
}
|
||||
|
||||
private function getRuleMock()
|
||||
|
|
Loading…
Reference in New Issue