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