diff --git a/composer.json b/composer.json index baa1b95c..bb9319c1 100644 --- a/composer.json +++ b/composer.json @@ -140,7 +140,7 @@ "test:db:ms": "DB_DRIVER=mssql composer test:db:sqlite", "test:api": "bin/test/run-api-tests.sh", "infect:ci:base": "infection --threads=4 --log-verbosity=default --only-covered --only-covering-test-cases --skip-initial-tests", - "infect:ci:unit": "@infect:ci:base --coverage=build/coverage-unit --min-msi=80", + "infect:ci:unit": "@infect:ci:base --coverage=build/coverage-unit --min-msi=83", "infect:ci:db": "@infect:ci:base --coverage=build/coverage-db --min-msi=95 --configuration=infection-db.json", "infect:ci": "@parallel infect:ci:unit infect:ci:db", "infect:test": [ diff --git a/module/Rest/test/Action/Visit/OrphanVisitsActionTest.php b/module/Rest/test/Action/Visit/OrphanVisitsActionTest.php index 9fec7e1f..43209e51 100644 --- a/module/Rest/test/Action/Visit/OrphanVisitsActionTest.php +++ b/module/Rest/test/Action/Visit/OrphanVisitsActionTest.php @@ -45,13 +45,16 @@ class OrphanVisitsActionTest extends TestCase $orphanVisits = $this->visitsHelper->orphanVisits(Argument::type(VisitsParams::class))->willReturn( new Paginator(new ArrayAdapter($visits)), ); + $visitsAmount = count($visits); $transform = $this->orphanVisitTransformer->transform(Argument::type(Visit::class))->willReturn([]); + /** @var JsonResponse $response */ $response = $this->action->handle(ServerRequestFactory::fromGlobals()); + $payload = $response->getPayload(); - self::assertInstanceOf(JsonResponse::class, $response); + self::assertCount($visitsAmount, $payload['visits']['data']); self::assertEquals(200, $response->getStatusCode()); $orphanVisits->shouldHaveBeenCalledOnce(); - $transform->shouldHaveBeenCalledTimes(count($visits)); + $transform->shouldHaveBeenCalledTimes($visitsAmount); } } diff --git a/module/Rest/test/ApiKey/Model/RoleDefinitionTest.php b/module/Rest/test/ApiKey/Model/RoleDefinitionTest.php new file mode 100644 index 00000000..8e6a58ad --- /dev/null +++ b/module/Rest/test/ApiKey/Model/RoleDefinitionTest.php @@ -0,0 +1,32 @@ +roleName()); + self::assertEquals([], $definition->meta()); + } + + /** @test */ + public function forDomainCreatesRoleDefinitionAsExpected(): void + { + $domain = Domain::withAuthority('foo.com')->setId('123'); + $definition = RoleDefinition::forDomain($domain); + + self::assertEquals(Role::DOMAIN_SPECIFIC, $definition->roleName()); + self::assertEquals(['domain_id' => '123', 'authority' => 'foo.com'], $definition->meta()); + } +}