databaseAccess = $this->createMock(DataBaseAccess::class); $this->sut = new RolePrivilegeRetriever(); $this->sut->setServiceLocator( $this->getServiceLocatorMock( [ DataBaseAccess::SERVICE_ID => $this->databaseAccess ] ) ); } public function testRetrieveByResourceIds(): void { $this->databaseAccess ->method('getUsersWithPermissions') ->with(['id']) ->willReturn( [ [ 'resource_id' => 'id', 'user_id' => 'http://www.tao.lu/Ontologies/TAO.rdf#BackOfficeRole', 'privilege' => 'READ' ], [ 'resource_id' => 'id', 'user_id' => 'http://www.tao.lu/Ontologies/TAO.rdf#BackOfficeRole', 'privilege' => 'WRITE' ], [ 'resource_id' => 'id', 'user_id' => 'http://www.tao.lu/Ontologies/TAO.rdf#BackOfficeRole', 'privilege' => 'GRANT' ] ] ); $this->assertSame( [ 'http://www.tao.lu/Ontologies/TAO.rdf#BackOfficeRole' => [ 'READ', 'WRITE', 'GRANT' ] ], $this->sut->retrieveByResourceIds(['id']) ); } }