@@ 175-191 (lines=17) @@ | ||
172 | * @test |
|
173 | * @covers ::ofScalars |
|
174 | */ |
|
175 | public function ofScalarsFail() |
|
176 | { |
|
177 | try { |
|
178 | Arrays::ofScalars(['1', [], new \StdClass], [['string']]); |
|
179 | $this->fail(); |
|
180 | } catch (Exception $e) { |
|
181 | $expected = <<<TXT |
|
182 | Field '1' with value 'array ( |
|
183 | )' failed filtering, message 'Value 'array ( |
|
184 | )' is not a string' |
|
185 | Field '2' with value 'stdClass::__set_state(array( |
|
186 | ))' failed filtering, message 'Value 'stdClass::__set_state(array( |
|
187 | ))' is not a string' |
|
188 | TXT; |
|
189 | $this->assertSame($expected, $e->getMessage()); |
|
190 | } |
|
191 | } |
|
192 | ||
193 | /** |
|
194 | * @test |
|
@@ 308-317 (lines=10) @@ | ||
305 | * @test |
|
306 | * @covers ::ofArray |
|
307 | */ |
|
308 | public function ofArrayUnknown() |
|
309 | { |
|
310 | try { |
|
311 | Arrays::ofArray(['key' => '1'], ['key2' => [['uint']]]); |
|
312 | $this->fail(); |
|
313 | } catch (Exception $e) { |
|
314 | $expected = "Field 'key' with value '1' is unknown"; |
|
315 | $this->assertSame($expected, $e->getMessage()); |
|
316 | } |
|
317 | } |
|
318 | ||
319 | /** |
|
320 | * Verifies the basic behavior of the flatten filter. |