build(FakeShell::new(ArrayType::native())); self::assertSame([], $node->value()); self::assertEmpty($node->node()->children()); } public function test_invalid_type_fails_assertion(): void { $this->expectException(AssertionError::class); (new RootNodeBuilder(new ArrayNodeBuilder(true)))->build(FakeShell::new(new FakeType())); } public function test_invalid_source_key_throws_exception(): void { $this->expectException(InvalidTraversableKey::class); $this->expectExceptionCode(1630946163); $this->expectExceptionMessage("Key 'foo' does not match type `int`."); $type = new ArrayType(ArrayKeyType::integer(), NativeStringType::get()); $value = [ 'foo' => 'key is not ok', ]; (new RootNodeBuilder(new ArrayNodeBuilder(true)))->build(FakeShell::new($type, $value)); } }