subject = new ResourceClasses(); } public function testGetStrings(): void { $type = $this->createMock(core_kernel_classes_Class::class); $parentClass = $this->createMock(core_kernel_classes_Class::class); $forbiddenParentParentClass = $this->createMock(core_kernel_classes_Class::class); $type->method('getLabel') ->willReturn('Type1'); $type->method('getParentClasses') ->willReturn( [ $parentClass, $forbiddenParentParentClass ] ); $parentClass->method('getLabel') ->willReturn('ParentClass1'); $parentClass->method('getUri') ->willReturn('someAllowedUri'); $forbiddenParentParentClass->method('getLabel') ->willReturn('Forbidden'); $forbiddenParentParentClass->method('getUri') ->willReturn('http://www.tao.lu/Ontologies/TAO.rdf#AssessmentContentObject'); $resource = $this->createMock(core_kernel_classes_Resource::class); $resource->method('getTypes') ->willReturn( [ $type, ] ); $this->assertSame( [ 'Type1', 'ParentClass1', ], $this->subject->getStrings($resource) ); } }