setAuthToken(AuthKeysFixture::ADMIN_API_KEY); $faker = \Faker\Factory::create(); $uuid = $faker->uuid; $this->post( self::ENDPOINT, [ 'name' => 'Test Organisation', 'description' => $faker->text, 'uuid' => $uuid, 'url' => 'http://example.com', 'nationality' => 'US', 'sector' => 'sector', 'type' => 'type', ] ); $this->assertResponseOk(); $this->assertResponseContains(sprintf('"uuid": "%s"', $uuid)); $this->assertDbRecordExists('Organisations', ['uuid' => $uuid]); //TODO: $this->assertRequestMatchesOpenApiSpec(); $this->assertResponseMatchesOpenApiSpec(self::ENDPOINT, 'post'); } public function testAddOrganisationNotAllowedAsRegularUser(): void { $this->setAuthToken(AuthKeysFixture::REGULAR_USER_API_KEY); $faker = \Faker\Factory::create(); $uuid = $faker->uuid; $this->post( self::ENDPOINT, [ 'name' => 'Test Organisation', 'description' => $faker->text, 'uuid' => $uuid, 'url' => 'http://example.com', 'nationality' => 'US', 'sector' => 'sector', 'type' => 'type', ] ); $this->assertResponseCode(405); $this->assertDbRecordNotExists('Organisations', ['uuid' => $uuid]); //TODO: $this->assertRequestMatchesOpenApiSpec(); $this->assertResponseMatchesOpenApiSpec(self::ENDPOINT, 'post'); } }