@@ 473-482 (lines=10) @@ | ||
470 | * @test |
|
471 | * @covers ::ofArrays |
|
472 | */ |
|
473 | public function ofArraysRequiredAndUnknown() |
|
474 | { |
|
475 | try { |
|
476 | Filterer::ofArrays([['key' => '1'], ['key2' => '2']], ['key' => ['required' => true, ['uint']]]); |
|
477 | $this->fail(); |
|
478 | } catch (Exception $e) { |
|
479 | $expected = "Field 'key' was required and not present\nField 'key2' with value '2' is unknown"; |
|
480 | $this->assertSame($expected, $e->getMessage()); |
|
481 | } |
|
482 | } |
|
483 | ||
484 | /** |
|
485 | * @test |
|
@@ 548-557 (lines=10) @@ | ||
545 | * @test |
|
546 | * @covers ::ofArray |
|
547 | */ |
|
548 | public function ofArrayRequiredFail() |
|
549 | { |
|
550 | try { |
|
551 | Filterer::ofArray(['key1' => '1'], ['key1' => [['uint']], 'key2' => ['required' => true, ['uint']]]); |
|
552 | $this->fail(); |
|
553 | } catch (FilterException $e) { |
|
554 | $expected = "Field 'key2' was required and not present"; |
|
555 | $this->assertSame($expected, $e->getMessage()); |
|
556 | } |
|
557 | } |
|
558 | ||
559 | /** |
|
560 | * @test |