| @@ 574-583 (lines=10) @@ | ||
| 571 | * @test |
|
| 572 | * @covers ::ofArrays |
|
| 573 | */ |
|
| 574 | public function ofArraysRequiredAndUnknown() |
|
| 575 | { |
|
| 576 | try { |
|
| 577 | Filterer::ofArrays([['key' => '1'], ['key2' => '2']], ['key' => ['required' => true, ['uint']]]); |
|
| 578 | $this->fail(); |
|
| 579 | } catch (Exception $e) { |
|
| 580 | $expected = "Field 'key' was required and not present\nField 'key2' with value '2' is unknown"; |
|
| 581 | $this->assertSame($expected, $e->getMessage()); |
|
| 582 | } |
|
| 583 | } |
|
| 584 | ||
| 585 | /** |
|
| 586 | * @test |
|
| @@ 649-658 (lines=10) @@ | ||
| 646 | * @test |
|
| 647 | * @covers ::ofArray |
|
| 648 | */ |
|
| 649 | public function ofArrayRequiredFail() |
|
| 650 | { |
|
| 651 | try { |
|
| 652 | Filterer::ofArray(['key1' => '1'], ['key1' => [['uint']], 'key2' => ['required' => true, ['uint']]]); |
|
| 653 | $this->fail(); |
|
| 654 | } catch (FilterException $e) { |
|
| 655 | $expected = "Field 'key2' was required and not present"; |
|
| 656 | $this->assertSame($expected, $e->getMessage()); |
|
| 657 | } |
|
| 658 | } |
|
| 659 | ||
| 660 | /** |
|
| 661 | * @test |
|