1
0
Fork 0

More ruletest fixes for 7.1

pull/5144/head
Jordi Boggiano 2016-04-01 11:58:42 +01:00
parent c74e6df65d
commit 1bd9c8da3c
1 changed files with 14 additions and 14 deletions

View File

@ -29,7 +29,7 @@ class RuleTest extends TestCase
public function testGetHash()
{
$rule = new Rule(array(123), 'job1', null);
$rule = new Rule(array(123), Rule::RULE_JOB_INSTALL, null);
$hash = unpack('ihash', md5('123', true));
$this->assertEquals($hash['hash'], $rule->getHash());
@ -37,31 +37,31 @@ class RuleTest extends TestCase
public function testEqualsForRulesWithDifferentHashes()
{
$rule = new Rule(array(1, 2), 'job1', null);
$rule2 = new Rule(array(1, 3), 'job1', null);
$rule = new Rule(array(1, 2), Rule::RULE_JOB_INSTALL, null);
$rule2 = new Rule(array(1, 3), Rule::RULE_JOB_INSTALL, null);
$this->assertFalse($rule->equals($rule2));
}
public function testEqualsForRulesWithDifferLiteralsQuantity()
{
$rule = new Rule(array(1, 12), 'job1', null);
$rule2 = new Rule(array(1), 'job1', null);
$rule = new Rule(array(1, 12), Rule::RULE_JOB_INSTALL, null);
$rule2 = new Rule(array(1), Rule::RULE_JOB_INSTALL, null);
$this->assertFalse($rule->equals($rule2));
}
public function testEqualsForRulesWithSameLiterals()
{
$rule = new Rule(array(1, 12), 'job1', null);
$rule2 = new Rule(array(1, 12), 'job1', null);
$rule = new Rule(array(1, 12), Rule::RULE_JOB_INSTALL, null);
$rule2 = new Rule(array(1, 12), Rule::RULE_JOB_INSTALL, null);
$this->assertTrue($rule->equals($rule2));
}
public function testSetAndGetType()
{
$rule = new Rule(array(), 'job1', null);
$rule = new Rule(array(), Rule::RULE_JOB_INSTALL, null);
$rule->setType(RuleSet::TYPE_JOB);
$this->assertEquals(RuleSet::TYPE_JOB, $rule->getType());
@ -69,7 +69,7 @@ class RuleTest extends TestCase
public function testEnable()
{
$rule = new Rule(array(), 'job1', null);
$rule = new Rule(array(), Rule::RULE_JOB_INSTALL, null);
$rule->disable();
$rule->enable();
@ -79,7 +79,7 @@ class RuleTest extends TestCase
public function testDisable()
{
$rule = new Rule(array(), 'job1', null);
$rule = new Rule(array(), Rule::RULE_JOB_INSTALL, null);
$rule->enable();
$rule->disable();
@ -89,8 +89,8 @@ class RuleTest extends TestCase
public function testIsAssertions()
{
$rule = new Rule(array(1, 12), 'job1', null);
$rule2 = new Rule(array(1), 'job1', null);
$rule = new Rule(array(1, 12), Rule::RULE_JOB_INSTALL, null);
$rule2 = new Rule(array(1), Rule::RULE_JOB_INSTALL, null);
$this->assertFalse($rule->isAssertion());
$this->assertTrue($rule2->isAssertion());
@ -103,8 +103,8 @@ class RuleTest extends TestCase
$repo->addPackage($p2 = $this->getPackage('baz', '1.1'));
$this->pool->addRepository($repo);
$rule = new Rule(array($p1->getId(), -$p2->getId()), 'job1', null);
$rule = new Rule(array($p1->getId(), -$p2->getId()), Rule::RULE_JOB_INSTALL, null);
$this->assertEquals('(don\'t install baz 1.1|install foo 2.1)', $rule->getPrettyString($this->pool));
$this->assertEquals('Install command rule (don\'t install baz 1.1|install foo 2.1)', $rule->getPrettyString($this->pool));
}
}