admin = UserFactory::refresh()->withTokens()->asAdmin()->create(); $this->user = UserFactory::refresh()->withTokens()->asUser()->create(); } public function test_index_as_admin(): void { $response = $this->actingAs($this->admin)->patchJson(self::URI); $response->assertOk(); } public function test_index_wrong_params(): void { $response = $this->actingAs($this->admin)->patchJson(self::URI, [ 'timezone' => $this->faker->text, ]); $response->assertValidationError(); } public function test_index_as_user(): void { $response = $this->actingAs($this->user)->patchJson(self::URI); $response->assertForbidden(); } }