self::RESOURCE_URI, 'body' => [ 'type' => [] ] ]; protected function setUp(): void { parent::setUp(); $this->serviceLocatorMock = $this->getServiceLocatorMock( [ Ontology::SERVICE_ID => $this->getOntologyMock(), PermissionInterface::SERVICE_ID => $this->createMock(PermissionInterface::class), SearchTokenGenerator::class => new SearchTokenGenerator(), LoggerService::SERVICE_ID => new NullLogger(), ] ); $this->builder = new IndexDocumentBuilder(); $this->builder->setServiceLocator($this->serviceLocatorMock); } public function testCreateEmptyDocumentFromResource(): void { $resource = $this->getOntologyMock()->getResource(self::RESOURCE_URI); $document = $this->builder->createDocumentFromResource($resource); $this->assertInstanceOf(IndexDocument::class, $document); $this->assertEquals(self::RESOURCE_URI, $document->getId()); $this->assertEquals(['type' => [], 'parent_classes' => ''], $document->getBody()); $this->assertEquals([], (array)$document->getDynamicProperties()); } public function testCreateDocumentFromResource(): void { $document = $this->builder->createDocumentFromArray( self::ARRAY_RESOURCE ); $this->assertInstanceOf(IndexDocument::class, $document); $this->assertEquals(self::RESOURCE_URI, $document->getId()); $this->assertEquals(['type' => []], $document->getBody()); $this->assertEquals([], (array)$document->getDynamicProperties()); } }