| @@ 550-559 (lines=10) @@ | ||
| 547 | * @test |
|
| 548 | * @covers ::ofArrays |
|
| 549 | */ |
|
| 550 | public function ofArraysRequiredAndUnknown() |
|
| 551 | { |
|
| 552 | try { |
|
| 553 | Filterer::ofArrays([['key' => '1'], ['key2' => '2']], ['key' => ['required' => true, ['uint']]]); |
|
| 554 | $this->fail(); |
|
| 555 | } catch (Exception $e) { |
|
| 556 | $expected = "Field 'key' was required and not present\nField 'key2' with value '2' is unknown"; |
|
| 557 | $this->assertSame($expected, $e->getMessage()); |
|
| 558 | } |
|
| 559 | } |
|
| 560 | ||
| 561 | /** |
|
| 562 | * @test |
|
| @@ 625-634 (lines=10) @@ | ||
| 622 | * @test |
|
| 623 | * @covers ::ofArray |
|
| 624 | */ |
|
| 625 | public function ofArrayRequiredFail() |
|
| 626 | { |
|
| 627 | try { |
|
| 628 | Filterer::ofArray(['key1' => '1'], ['key1' => [['uint']], 'key2' => ['required' => true, ['uint']]]); |
|
| 629 | $this->fail(); |
|
| 630 | } catch (FilterException $e) { |
|
| 631 | $expected = "Field 'key2' was required and not present"; |
|
| 632 | $this->assertSame($expected, $e->getMessage()); |
|
| 633 | } |
|
| 634 | } |
|
| 635 | ||
| 636 | /** |
|
| 637 | * @test |
|