@@ 487-503 (lines=17) @@ | ||
484 | * @test |
|
485 | * @covers ::ofScalars |
|
486 | */ |
|
487 | public function ofScalarsFail() |
|
488 | { |
|
489 | try { |
|
490 | Filterer::ofScalars(['1', [], new \StdClass], [['string']]); |
|
491 | $this->fail(); |
|
492 | } catch (FilterException $e) { |
|
493 | $expected = <<<TXT |
|
494 | Field '1' with value 'array ( |
|
495 | )' failed filtering, message 'Value 'array ( |
|
496 | )' is not a string' |
|
497 | Field '2' with value 'stdClass::__set_state(array( |
|
498 | ))' failed filtering, message 'Value 'stdClass::__set_state(array( |
|
499 | ))' is not a string' |
|
500 | TXT; |
|
501 | $this->assertSame($expected, $e->getMessage()); |
|
502 | } |
|
503 | } |
|
504 | ||
505 | /** |
|
506 | * @test |
|
@@ 620-629 (lines=10) @@ | ||
617 | * @test |
|
618 | * @covers ::ofArray |
|
619 | */ |
|
620 | public function ofArrayUnknown() |
|
621 | { |
|
622 | try { |
|
623 | Filterer::ofArray(['key' => '1'], ['key2' => [['uint']]]); |
|
624 | $this->fail(); |
|
625 | } catch (FilterException $e) { |
|
626 | $expected = "Field 'key' with value '1' is unknown"; |
|
627 | $this->assertSame($expected, $e->getMessage()); |
|
628 | } |
|
629 | } |
|
630 | } |
|
631 |