setAuthToken(AuthKeysFixture::ADMIN_API_KEY); $faker = \Faker\Factory::create(); $uuid = $faker->uuid; $this->post( self::ENDPOINT, [ 'uuid' => $uuid, 'name' => 'Test Sharing Group', 'releasability' => 'Test Sharing Group releasability', 'description' => 'Test Sharing Group description', 'organisation_id' => OrganisationsFixture::ORGANISATION_A_ID, 'user_id' => UsersFixture::USER_ADMIN_ID, 'active' => true, 'local' => true ] ); $this->assertResponseOk(); $this->assertResponseContains(sprintf('"uuid": "%s"', $uuid)); $this->assertDbRecordExists('SharingGroups', ['uuid' => $uuid]); //TODO: $this->assertRequestMatchesOpenApiSpec(); $this->assertResponseMatchesOpenApiSpec(self::ENDPOINT, 'post'); } public function testAddSharingGroupNotAllowedAsRegularUser(): void { $this->setAuthToken(AuthKeysFixture::REGULAR_USER_API_KEY); $faker = \Faker\Factory::create(); $uuid = $faker->uuid; $this->post( self::ENDPOINT, [ 'uuid' => $uuid, 'name' => 'Test Sharing Group', 'releasability' => 'Sharing Group A', 'description' => 'Sharing Group A description', 'organisation_id' => OrganisationsFixture::ORGANISATION_A_ID, 'user_id' => UsersFixture::USER_ADMIN_ID, 'active' => true, 'local' => true ] ); $this->assertResponseCode(405); $this->assertDbRecordNotExists('SharingGroups', ['uuid' => $uuid]); //TODO: $this->assertRequestMatchesOpenApiSpec(); $this->assertResponseMatchesOpenApiSpec(self::ENDPOINT, 'post'); } }