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