@@ 494-510 (lines=17) @@ | ||
491 | * @test |
|
492 | * @covers ::ofScalars |
|
493 | */ |
|
494 | public function ofScalarsFail() |
|
495 | { |
|
496 | try { |
|
497 | Filterer::ofScalars(['1', [], new stdClass], [['string']]); |
|
498 | $this->fail(); |
|
499 | } catch (FilterException $e) { |
|
500 | $expected = <<<TXT |
|
501 | Field '1' with value 'array ( |
|
502 | )' failed filtering, message 'Value 'array ( |
|
503 | )' is not a string' |
|
504 | Field '2' with value 'stdClass::__set_state(array( |
|
505 | ))' failed filtering, message 'Value 'stdClass::__set_state(array( |
|
506 | ))' is not a string' |
|
507 | TXT; |
|
508 | $this->assertSame($expected, $e->getMessage()); |
|
509 | } |
|
510 | } |
|
511 | ||
512 | /** |
|
513 | * @test |
|
@@ 627-636 (lines=10) @@ | ||
624 | * @test |
|
625 | * @covers ::ofArray |
|
626 | */ |
|
627 | public function ofArrayUnknown() |
|
628 | { |
|
629 | try { |
|
630 | Filterer::ofArray(['key' => '1'], ['key2' => [['uint']]]); |
|
631 | $this->fail(); |
|
632 | } catch (FilterException $e) { |
|
633 | $expected = "Field 'key' with value '1' is unknown"; |
|
634 | $this->assertSame($expected, $e->getMessage()); |
|
635 | } |
|
636 | } |
|
637 | } |
|
638 |