setAuthToken(AuthKeysFixture::ADMIN_API_KEY); $url = sprintf('%s/%d', self::ENDPOINT, IndividualsFixture::INDIVIDUAL_REGULAR_USER_ID); $this->put( $url, [ 'email' => 'foo@bar.com', ] ); $this->assertResponseOk(); $this->assertDbRecordExists('Individuals', [ 'id' => IndividualsFixture::INDIVIDUAL_REGULAR_USER_ID, 'email' => 'foo@bar.com' ]); } public function testEditAnyIndividualNotAllowedAsRegularUser(): void { $this->setAuthToken(AuthKeysFixture::REGULAR_USER_API_KEY); $url = sprintf('%s/%d', self::ENDPOINT, IndividualsFixture::INDIVIDUAL_ADMIN_ID); $this->put( $url, [ 'email' => 'foo@bar.com', ] ); $this->assertResponseCode(405); $this->assertDbRecordNotExists('Individuals', [ 'id' => IndividualsFixture::INDIVIDUAL_ADMIN_ID, 'email' => 'foo@bar.com' ]); } }