| @@ 531-547 (lines=17) @@ | ||
| 528 | * @test |
|
| 529 | * @covers ::ofScalars |
|
| 530 | */ |
|
| 531 | public function ofScalarsFail() |
|
| 532 | { |
|
| 533 | try { |
|
| 534 | Filterer::ofScalars(['1', [], new stdClass], [['string']]); |
|
| 535 | $this->fail(); |
|
| 536 | } catch (FilterException $e) { |
|
| 537 | $expected = <<<TXT |
|
| 538 | Field '1' with value 'array ( |
|
| 539 | )' failed filtering, message 'Value 'array ( |
|
| 540 | )' is not a string' |
|
| 541 | Field '2' with value 'stdClass::__set_state(array( |
|
| 542 | ))' failed filtering, message 'Value 'stdClass::__set_state(array( |
|
| 543 | ))' is not a string' |
|
| 544 | TXT; |
|
| 545 | $this->assertSame($expected, $e->getMessage()); |
|
| 546 | } |
|
| 547 | } |
|
| 548 | ||
| 549 | /** |
|
| 550 | * @test |
|
| @@ 664-673 (lines=10) @@ | ||
| 661 | * @test |
|
| 662 | * @covers ::ofArray |
|
| 663 | */ |
|
| 664 | public function ofArrayUnknown() |
|
| 665 | { |
|
| 666 | try { |
|
| 667 | Filterer::ofArray(['key' => '1'], ['key2' => [['uint']]]); |
|
| 668 | $this->fail(); |
|
| 669 | } catch (FilterException $e) { |
|
| 670 | $expected = "Field 'key' with value '1' is unknown"; |
|
| 671 | $this->assertSame($expected, $e->getMessage()); |
|
| 672 | } |
|
| 673 | } |
|
| 674 | ||
| 675 | /** |
|
| 676 | * @test |
|