| Total Complexity | 1 |
| Total Lines | 22 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class SetRuleTest extends CommonTestClass |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @throws TableException |
||
| 15 | */ |
||
| 16 | public function testMatch(): void |
||
| 17 | { |
||
| 18 | $lib = new Rules\Set(); |
||
| 19 | $lib->addRule(new Rules\Always('first extra rule')); |
||
| 20 | $lib->addRule(new Rules\Always('another extra rule')); |
||
| 21 | |||
| 22 | $lib->allMustPass(false); |
||
| 23 | $this->assertTrue($lib->validate('2')); |
||
| 24 | |||
| 25 | $lib->allMustPass(true); |
||
| 26 | $this->assertTrue($lib->validate('2')); |
||
| 27 | |||
| 28 | $lib->addRule(new Rules\Negate(new Rules\Always('this will fail them'))); |
||
| 29 | $this->assertFalse($lib->validate('2')); |
||
| 30 | |||
| 31 | $lib->allMustPass(false); |
||
| 32 | $this->assertTrue($lib->validate('2')); |
||
| 33 | } |
||
| 35 |