@@ 530-539 (lines=10) @@ | ||
527 | * @test |
|
528 | * @covers ::ofArrays |
|
529 | */ |
|
530 | public function ofArraysRequiredAndUnknown() |
|
531 | { |
|
532 | try { |
|
533 | Filterer::ofArrays([['key' => '1'], ['key2' => '2']], ['key' => ['required' => true, ['uint']]]); |
|
534 | $this->fail(); |
|
535 | } catch (Exception $e) { |
|
536 | $expected = "Field 'key' was required and not present\nField 'key2' with value '2' is unknown"; |
|
537 | $this->assertSame($expected, $e->getMessage()); |
|
538 | } |
|
539 | } |
|
540 | ||
541 | /** |
|
542 | * @test |
|
@@ 605-614 (lines=10) @@ | ||
602 | * @test |
|
603 | * @covers ::ofArray |
|
604 | */ |
|
605 | public function ofArrayRequiredFail() |
|
606 | { |
|
607 | try { |
|
608 | Filterer::ofArray(['key1' => '1'], ['key1' => [['uint']], 'key2' => ['required' => true, ['uint']]]); |
|
609 | $this->fail(); |
|
610 | } catch (FilterException $e) { |
|
611 | $expected = "Field 'key2' was required and not present"; |
|
612 | $this->assertSame($expected, $e->getMessage()); |
|
613 | } |
|
614 | } |
|
615 | ||
616 | /** |
|
617 | * @test |