@@ 507-523 (lines=17) @@ | ||
504 | * @test |
|
505 | * @covers ::ofScalars |
|
506 | */ |
|
507 | public function ofScalarsFail() |
|
508 | { |
|
509 | try { |
|
510 | Filterer::ofScalars(['1', [], new \StdClass], [['string']]); |
|
511 | $this->fail(); |
|
512 | } catch (FilterException $e) { |
|
513 | $expected = <<<TXT |
|
514 | Field '1' with value 'array ( |
|
515 | )' failed filtering, message 'Value 'array ( |
|
516 | )' is not a string' |
|
517 | Field '2' with value 'stdClass::__set_state(array( |
|
518 | ))' failed filtering, message 'Value 'stdClass::__set_state(array( |
|
519 | ))' is not a string' |
|
520 | TXT; |
|
521 | $this->assertSame($expected, $e->getMessage()); |
|
522 | } |
|
523 | } |
|
524 | ||
525 | /** |
|
526 | * @test |
|
@@ 640-649 (lines=10) @@ | ||
637 | * @test |
|
638 | * @covers ::ofArray |
|
639 | */ |
|
640 | public function ofArrayUnknown() |
|
641 | { |
|
642 | try { |
|
643 | Filterer::ofArray(['key' => '1'], ['key2' => [['uint']]]); |
|
644 | $this->fail(); |
|
645 | } catch (FilterException $e) { |
|
646 | $expected = "Field 'key' with value '1' is unknown"; |
|
647 | $this->assertSame($expected, $e->getMessage()); |
|
648 | } |
|
649 | } |
|
650 | ||
651 | /** |
|
652 | * @tests |