- Plugins nach WordPress-Prinzip: plugin.json-Manifest mit Versions- und Abhängigkeitsprüfung, eigenes PSR-4-Autoloading, register()/boot(), activate()/deactivate()/uninstall(), Migrationen, Routen und Views je Plugin - plugins-core/ (mitgeliefert, aktiv bis zur Deaktivierung) und plugins/ (Kunden-Plugins, geschützt vor Updates, inaktiv bis zur Aktivierung) - Zustand in storage/app/plugins.json – Laden ohne Datenbankabfrage - Wiederherstellungsmodus: Ausnahmen und Fatal Errors beim Laden deaktivieren das Plugin, das Portal bleibt erreichbar - Hooks (Actions/Filter mit Prioritäten) und Registries für Navigation, Startseiten-Kacheln, Rechte und Admin-Seiten (Filament-Discovery) - Admin-Seite „Plugins“: aktivieren, deaktivieren, per ZIP installieren (ZIP-Slip-Schutz), löschen mit oder ohne Daten; abschaltbar per INHAUS_DISALLOW_FILE_MODS - Startseite komplett aus Kacheln; Plugin-Seiten als „slug::Seite“ - Version 0.3.0 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
70 lines
2.5 KiB
PHP
70 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\User;
|
|
use App\Support\Settings;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class DashboardTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_dashboard_shows_default_quick_links(): void
|
|
{
|
|
$response = $this->actingAs(User::factory()->create())->get('/')->assertOk();
|
|
$links = $this->dashboardWidget($response, 'core.quick-links')['links'];
|
|
|
|
$this->assertCount(2, $links);
|
|
$this->assertSame('/personen', $links[0]['url']);
|
|
}
|
|
|
|
public function test_configured_quick_links_are_sanitized(): void
|
|
{
|
|
app(Settings::class)->set('portal.quick_links', [
|
|
['label' => 'Zeiterfassung', 'url' => 'https://zeit.example.com', 'icon' => 'clock', 'new_tab' => true],
|
|
['label' => 'Böse', 'url' => 'javascript:alert(1)', 'icon' => 'unbekannt'],
|
|
]);
|
|
|
|
$links = $this->dashboardWidget($this->actingAs(User::factory()->create())->get('/'), 'core.quick-links')['links'];
|
|
|
|
$this->assertSame('clock', $links[0]['icon']);
|
|
$this->assertTrue($links[0]['new_tab']);
|
|
$this->assertSame('#', $links[1]['url']);
|
|
$this->assertSame('link', $links[1]['icon']);
|
|
}
|
|
|
|
public function test_new_colleagues_exclude_self_inactive_and_old_accounts(): void
|
|
{
|
|
$me = User::factory()->create();
|
|
$new = User::factory()->create();
|
|
User::factory()->inactive()->create();
|
|
User::factory()->create(['created_at' => now()->subYear()]);
|
|
|
|
$response = $this->actingAs($me)->get('/');
|
|
|
|
$people = $this->dashboardWidget($response, 'core.new-colleagues')['people'];
|
|
$this->assertCount(1, $people);
|
|
$this->assertSame($new->id, $people[0]['id']);
|
|
$this->assertSame(3, $this->dashboardWidget($response, 'core.people-search')['count']);
|
|
}
|
|
|
|
public function test_brand_colors_are_rendered_as_css_variables(): void
|
|
{
|
|
app(Settings::class)->set('branding.primary_color', '#E20074');
|
|
|
|
$this->actingAs(User::factory()->create())
|
|
->get('/')
|
|
->assertSee('--brand:#E20074', false)
|
|
->assertSee('--brand-600:#E20074', false)
|
|
->assertSee('--brand-foreground:#FFFFFF', false);
|
|
}
|
|
|
|
public function test_dark_theme_is_applied_server_side(): void
|
|
{
|
|
$this->actingAs(User::factory()->create(['theme' => 'dark']))
|
|
->get('/')
|
|
->assertSee('class="dark"', false);
|
|
}
|
|
}
|