| Total Complexity | 4 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class SafeRulesTest extends CommonTestClass |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @param string $key |
||
| 11 | * @param string $expectedValue |
||
| 12 | * @param string $checkValue |
||
| 13 | * @param bool $gotResult |
||
| 14 | * @throws RuleException |
||
| 15 | * @dataProvider equalsProvider |
||
| 16 | */ |
||
| 17 | public function testEqualsSafeBasic(string $key, string $expectedValue, string $checkValue, bool $gotResult): void |
||
| 18 | { |
||
| 19 | $data = new Rules\Safe\HashedBasicEquals(); |
||
| 20 | $data->setAgainstValue($expectedValue); |
||
| 21 | $this->assertInstanceOf(Rules\ARule::class, $data); |
||
| 22 | $mock = MockEntry::init($key, $checkValue); |
||
| 23 | if (!$gotResult) $this->expectException(RuleException::class); |
||
| 24 | $data->validate($mock); |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @param string $key |
||
| 29 | * @param string $expectedValue |
||
| 30 | * @param string $checkValue |
||
| 31 | * @param bool $gotResult |
||
| 32 | * @throws RuleException |
||
| 33 | * @dataProvider equalsProvider |
||
| 34 | */ |
||
| 35 | public function testEqualsSafeFunc(string $key, string $expectedValue, string $checkValue, bool $gotResult): void |
||
| 36 | { |
||
| 37 | $data = new Rules\Safe\HashedFuncEquals(); |
||
| 38 | $data->setAgainstValue($expectedValue); |
||
| 39 | $this->assertInstanceOf(Rules\ARule::class, $data); |
||
| 40 | $mock = MockEntry::init($key, $checkValue); |
||
| 41 | if (!$gotResult) $this->expectException(RuleException::class); |
||
| 42 | $data->validate($mock); |
||
| 43 | } |
||
| 45 |