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