user = User::factory()->create(); actingAs($this->user); }); it('returns the environment show inertia view', function () { $organisation = Organisation::factory()->create(); $application = Application::factory()->create([ 'organisation_id' => $organisation->id, ]); $environment = Environment::factory()->create([ 'application_id' => $application->id, ]); $response = $this->get(route('environments.show', [ 'organisation' => $organisation->id, 'application' => $application->id, 'environment' => $environment->id, ])); $response->assertStatus(200); $response->assertInertia(fn (AssertableInertia $page) => $page ->component('environments/Show', false)); }); it('404s when the environment does not belong to the application', function () { $organisation = Organisation::factory()->create(); $application = Application::factory()->create([ 'organisation_id' => $organisation->id, ]); $otherApplication = Application::factory()->create([ 'organisation_id' => $organisation->id, ]); $environment = Environment::factory()->create([ 'application_id' => $otherApplication->id, ]); $response = $this->get(route('environments.show', [ 'organisation' => $organisation->id, 'application' => $application->id, 'environment' => $environment->id, ])); $response->assertNotFound(); });