get(config('domains.domain_portal_url').'/dashboard'); $response->assertRedirect(route('login')); }); test('admins can visit the dashboard', function () { /** @var TestCase $this */ $this->seed(RolesAndPermissionsSeeder::class); $admin = User::factory()->create(['is_active' => true]); $admin->assignRole('admin'); $this->actingAs($admin); $response = $this->get(config('domains.domain_portal_url').'/dashboard'); $response->assertSuccessful(); }); test('dashboard renders aggregated press release stats', function () { /** @var TestCase $this */ $this->seed(RolesAndPermissionsSeeder::class); $admin = User::factory()->create(['is_active' => true]); $admin->assignRole('admin'); $this->actingAs($admin); $company = Company::factory()->create(); PressRelease::factory() ->published() ->create([ 'user_id' => $admin->id, 'company_id' => $company->id, 'title' => 'Veröffentlichte Dashboard PM', ]); PressRelease::factory() ->inReview() ->create([ 'user_id' => $admin->id, 'company_id' => $company->id, 'title' => 'Review Dashboard PM', ]); PressRelease::factory()->create([ 'user_id' => $admin->id, 'company_id' => $company->id, 'status' => PressReleaseStatus::Draft->value, ]); $this->get(config('domains.domain_portal_url').'/dashboard') ->assertSuccessful() ->assertSee('3') ->assertSee('1 pub') ->assertSee('1 prüf') ->assertSee('1 entwurf') ->assertSee('Review Dashboard PM'); });