| @@ 185-194 (lines=10) @@ | ||
| 182 | * @test |
|
| 183 | * @covers ::ofArrays |
|
| 184 | */ |
|
| 185 | public function ofArraysRequiredAndUnknown() |
|
| 186 | { |
|
| 187 | try { |
|
| 188 | Arrays::ofArrays([['key' => '1'], ['key2' => '2']], ['key' => ['required' => true, ['uint']]]); |
|
| 189 | $this->fail(); |
|
| 190 | } catch (Exception $e) { |
|
| 191 | $expected = "Field 'key' was required and not present\nField 'key2' with value '2' is unknown"; |
|
| 192 | $this->assertSame($expected, $e->getMessage()); |
|
| 193 | } |
|
| 194 | } |
|
| 195 | ||
| 196 | /** |
|
| 197 | * @test |
|
| @@ 260-269 (lines=10) @@ | ||
| 257 | * @test |
|
| 258 | * @covers ::ofArray |
|
| 259 | */ |
|
| 260 | public function ofArrayRequiredFail() |
|
| 261 | { |
|
| 262 | try { |
|
| 263 | Arrays::ofArray(['key1' => '1'], ['key1' => [['uint']], 'key2' => ['required' => true, ['uint']]]); |
|
| 264 | $this->fail(); |
|
| 265 | } catch (Exception $e) { |
|
| 266 | $expected = "Field 'key2' was required and not present"; |
|
| 267 | $this->assertSame($expected, $e->getMessage()); |
|
| 268 | } |
|
| 269 | } |
|
| 270 | ||
| 271 | /** |
|
| 272 | * @test |
|