| @@ 430-446 (lines=17) @@ | ||
| 427 | * @test |
|
| 428 | * @covers ::ofScalars |
|
| 429 | */ |
|
| 430 | public function ofScalarsFail() |
|
| 431 | { |
|
| 432 | try { |
|
| 433 | Filterer::ofScalars(['1', [], new \StdClass], [['string']]); |
|
| 434 | $this->fail(); |
|
| 435 | } catch (FilterException $e) { |
|
| 436 | $expected = <<<TXT |
|
| 437 | Field '1' with value 'array ( |
|
| 438 | )' failed filtering, message 'Value 'array ( |
|
| 439 | )' is not a string' |
|
| 440 | Field '2' with value 'stdClass::__set_state(array( |
|
| 441 | ))' failed filtering, message 'Value 'stdClass::__set_state(array( |
|
| 442 | ))' is not a string' |
|
| 443 | TXT; |
|
| 444 | $this->assertSame($expected, $e->getMessage()); |
|
| 445 | } |
|
| 446 | } |
|
| 447 | ||
| 448 | /** |
|
| 449 | * @test |
|
| @@ 563-572 (lines=10) @@ | ||
| 560 | * @test |
|
| 561 | * @covers ::ofArray |
|
| 562 | */ |
|
| 563 | public function ofArrayUnknown() |
|
| 564 | { |
|
| 565 | try { |
|
| 566 | Filterer::ofArray(['key' => '1'], ['key2' => [['uint']]]); |
|
| 567 | $this->fail(); |
|
| 568 | } catch (FilterException $e) { |
|
| 569 | $expected = "Field 'key' with value '1' is unknown"; |
|
| 570 | $this->assertSame($expected, $e->getMessage()); |
|
| 571 | } |
|
| 572 | } |
|
| 573 | } |
|
| 574 | ||