Make ruleHash a protected member of rules
parent
fa7bd35413
commit
c869566868
|
@ -38,7 +38,7 @@ class Rule
|
||||||
|
|
||||||
protected $job;
|
protected $job;
|
||||||
|
|
||||||
public $ruleHash;
|
protected $ruleHash;
|
||||||
|
|
||||||
public function __construct(Pool $pool, array $literals, $reason, $reasonData, $job = null)
|
public function __construct(Pool $pool, array $literals, $reason, $reasonData, $job = null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,10 +28,9 @@ class RuleTest extends TestCase
|
||||||
|
|
||||||
public function testGetHash()
|
public function testGetHash()
|
||||||
{
|
{
|
||||||
$rule = new Rule($this->pool, array(), 'job1', null);
|
$rule = new Rule($this->pool, array(123), 'job1', null);
|
||||||
$rule->ruleHash = '123';
|
|
||||||
|
|
||||||
$this->assertEquals('123', $rule->getHash());
|
$this->assertEquals(substr(md5('123'), 0, 5), $rule->getHash());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetAndGetId()
|
public function testSetAndGetId()
|
||||||
|
@ -44,22 +43,8 @@ class RuleTest extends TestCase
|
||||||
|
|
||||||
public function testEqualsForRulesWithDifferentHashes()
|
public function testEqualsForRulesWithDifferentHashes()
|
||||||
{
|
{
|
||||||
$rule = new Rule($this->pool, array(), 'job1', null);
|
$rule = new Rule($this->pool, array(1, 2), 'job1', null);
|
||||||
$rule->ruleHash = '123';
|
$rule2 = new Rule($this->pool, array(1, 3), 'job1', null);
|
||||||
|
|
||||||
$rule2 = new Rule($this->pool, array(), 'job1', null);
|
|
||||||
$rule2->ruleHash = '321';
|
|
||||||
|
|
||||||
$this->assertFalse($rule->equals($rule2));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testEqualsForRulesWithDifferentLiterals()
|
|
||||||
{
|
|
||||||
$rule = new Rule($this->pool, array(1), 'job1', null);
|
|
||||||
$rule->ruleHash = '123';
|
|
||||||
|
|
||||||
$rule2 = new Rule($this->pool, array(12), 'job1', null);
|
|
||||||
$rule2->ruleHash = '123';
|
|
||||||
|
|
||||||
$this->assertFalse($rule->equals($rule2));
|
$this->assertFalse($rule->equals($rule2));
|
||||||
}
|
}
|
||||||
|
@ -67,14 +52,12 @@ class RuleTest extends TestCase
|
||||||
public function testEqualsForRulesWithDifferLiteralsQuantity()
|
public function testEqualsForRulesWithDifferLiteralsQuantity()
|
||||||
{
|
{
|
||||||
$rule = new Rule($this->pool, array(1, 12), 'job1', null);
|
$rule = new Rule($this->pool, array(1, 12), 'job1', null);
|
||||||
$rule->ruleHash = '123';
|
|
||||||
$rule2 = new Rule($this->pool, array(1), 'job1', null);
|
$rule2 = new Rule($this->pool, array(1), 'job1', null);
|
||||||
$rule2->ruleHash = '123';
|
|
||||||
|
|
||||||
$this->assertFalse($rule->equals($rule2));
|
$this->assertFalse($rule->equals($rule2));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEqualsForRulesWithThisSameLiterals()
|
public function testEqualsForRulesWithSameLiterals()
|
||||||
{
|
{
|
||||||
$rule = new Rule($this->pool, array(1, 12), 'job1', null);
|
$rule = new Rule($this->pool, array(1, 12), 'job1', null);
|
||||||
$rule2 = new Rule($this->pool, array(1, 12), 'job1', null);
|
$rule2 = new Rule($this->pool, array(1, 12), 'job1', null);
|
||||||
|
|
Loading…
Reference in New Issue