createMock(Environment::class); $nodeInstantiator = new NodeInstantiator(NodeTypes::DOCUMENT, DocumentNode::class, $environment); self::assertSame(NodeTypes::DOCUMENT, $nodeInstantiator->getType()); } public function testInvalidTypeThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Node type invalid is not a valid node type.'); $environment = $this->createMock(Environment::class); $nodeInstantiator = new NodeInstantiator('invalid', DocumentNode::class, $environment); } public function testCreate(): void { $environment = $this->createMock(Environment::class); $nodeInstantiator = new NodeInstantiator(NodeTypes::DOCUMENT, DocumentNode::class, $environment); $document = $nodeInstantiator->create([$environment]); self::assertInstanceOf(DocumentNode::class, $document); } }