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