ontology = $this->createMock(Ontology::class); $this->subject = new ItemResourceRelationService( [ ItemResourceRelationService::OPTION_NESTED_CLASS_LIMIT => 0 ] ); $this->subject->setServiceLocator( $this->getServiceLocatorMock( [ Ontology::SERVICE_ID => $this->ontology, ] ) ); } public function testGetRelations(): void { $this->assertCount( 0, $this->subject->findRelations(new FindAllQuery('itemId'))->getIterator()->getArrayCopy() ); } public function testGetRelationsWithNestedClassLimitExceededWillThrowException(): void { $this->expectException(NestedClassLimitExceededException::class); $class = $this->createMock(core_kernel_classes_Class::class); $class->method('getSubClasses') ->willReturn([1]); $this->ontology ->method('getClass') ->willReturn($class); $this->subject->findRelations(new FindAllQuery(null, 'classId')); } }