@@ 218-227 (lines=10) @@ | ||
215 | * @test |
|
216 | * @covers ::ofArrays |
|
217 | */ |
|
218 | public function ofArraysRequiredAndUnknown() |
|
219 | { |
|
220 | try { |
|
221 | Arrays::ofArrays([['key' => '1'], ['key2' => '2']], ['key' => ['required' => true, ['uint']]]); |
|
222 | $this->fail(); |
|
223 | } catch (Exception $e) { |
|
224 | $expected = "Field 'key' was required and not present\nField 'key2' with value '2' is unknown"; |
|
225 | $this->assertSame($expected, $e->getMessage()); |
|
226 | } |
|
227 | } |
|
228 | ||
229 | /** |
|
230 | * @test |
|
@@ 293-302 (lines=10) @@ | ||
290 | * @test |
|
291 | * @covers ::ofArray |
|
292 | */ |
|
293 | public function ofArrayRequiredFail() |
|
294 | { |
|
295 | try { |
|
296 | Arrays::ofArray(['key1' => '1'], ['key1' => [['uint']], 'key2' => ['required' => true, ['uint']]]); |
|
297 | $this->fail(); |
|
298 | } catch (Exception $e) { |
|
299 | $expected = "Field 'key2' was required and not present"; |
|
300 | $this->assertSame($expected, $e->getMessage()); |
|
301 | } |
|
302 | } |
|
303 | ||
304 | /** |
|
305 | * @test |