| @@ 537-546 (lines=10) @@ | ||
| 534 | * @test |
|
| 535 | * @covers ::ofArrays |
|
| 536 | */ |
|
| 537 | public function ofArraysRequiredAndUnknown() |
|
| 538 | { |
|
| 539 | try { |
|
| 540 | Filterer::ofArrays([['key' => '1'], ['key2' => '2']], ['key' => ['required' => true, ['uint']]]); |
|
| 541 | $this->fail(); |
|
| 542 | } catch (Exception $e) { |
|
| 543 | $expected = "Field 'key' was required and not present\nField 'key2' with value '2' is unknown"; |
|
| 544 | $this->assertSame($expected, $e->getMessage()); |
|
| 545 | } |
|
| 546 | } |
|
| 547 | ||
| 548 | /** |
|
| 549 | * @test |
|
| @@ 612-621 (lines=10) @@ | ||
| 609 | * @test |
|
| 610 | * @covers ::ofArray |
|
| 611 | */ |
|
| 612 | public function ofArrayRequiredFail() |
|
| 613 | { |
|
| 614 | try { |
|
| 615 | Filterer::ofArray(['key1' => '1'], ['key1' => [['uint']], 'key2' => ['required' => true, ['uint']]]); |
|
| 616 | $this->fail(); |
|
| 617 | } catch (FilterException $e) { |
|
| 618 | $expected = "Field 'key2' was required and not present"; |
|
| 619 | $this->assertSame($expected, $e->getMessage()); |
|
| 620 | } |
|
| 621 | } |
|
| 622 | ||
| 623 | /** |
|
| 624 | * @test |
|