All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m38s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m31s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m39s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m54s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 3m50s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 3m55s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 3m18s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 3m19s
CI / Build-Artefakte aktuell (pull_request) Successful in 55s
Der Name „Dokumente“ bleibt dem kommenden QM-Modul (QM-Dokumente und -Formulare) vorbehalten. - Plugin plugins-core/downloads (Inhaus\Plugins\Downloads), Adresse /downloads, Rechte downloads.*, Objekttyp download_folder, Block downloads.folder, Kachel downloads.favorites - Migration für bestehende Installationen: Tabellen und Spalten, Rechte, Sichtbarkeiten, Menü, Startseiten-Anordnung, Blöcke in Seiten und Fassungen, Plugin-Zustand; mit Test - Alte Links unter /dokumente leiten dauerhaft weiter Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
55 lines
2 KiB
PHP
55 lines
2 KiB
PHP
<?php
|
||
|
||
namespace Tests\Feature\Plugins;
|
||
|
||
use App\Models\User;
|
||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||
use Inertia\Testing\AssertableInertia as Assert;
|
||
use Tests\TestCase;
|
||
|
||
/**
|
||
* Deaktivierte Plugins hinterlassen keine Spuren im Portal.
|
||
*/
|
||
class CorePluginToggleTest extends TestCase
|
||
{
|
||
use RefreshDatabase;
|
||
|
||
private ?string $previousState = null;
|
||
|
||
protected function setUp(): void
|
||
{
|
||
parent::setUp();
|
||
|
||
$file = storage_path('app/plugins.json');
|
||
$this->previousState = is_file($file) ? file_get_contents($file) : null;
|
||
file_put_contents($file, json_encode(['news' => ['enabled' => false], 'events' => ['enabled' => false], 'pages' => ['enabled' => false], 'forms' => ['enabled' => false], 'wordpress-import' => ['enabled' => false], 'downloads' => ['enabled' => false]]));
|
||
|
||
// Plugins werden beim Start der Anwendung geladen – also neu starten.
|
||
$this->refreshApplication();
|
||
$this->setUpTraits();
|
||
}
|
||
|
||
protected function tearDown(): void
|
||
{
|
||
$file = storage_path('app/plugins.json');
|
||
$this->previousState === null ? @unlink($file) : file_put_contents($file, $this->previousState);
|
||
|
||
parent::tearDown();
|
||
}
|
||
|
||
public function test_disabled_plugins_disappear_from_navigation_dashboard_routes_and_admin(): void
|
||
{
|
||
$admin = User::factory()->admin()->create();
|
||
|
||
$response = $this->actingAs($admin)->get('/')->assertOk()
|
||
->assertInertia(fn (Assert $page) => $page->where('navigation', fn ($items) => collect($items)->pluck('key')->all() === ['home', 'people']));
|
||
|
||
$this->assertNull($this->dashboardWidget($response, 'news.latest'));
|
||
$this->assertNull($this->dashboardWidget($response, 'events.upcoming'));
|
||
$this->assertNotNull($this->dashboardWidget($response, 'core.quick-links'));
|
||
|
||
$this->actingAs($admin)->get('/neuigkeiten')->assertNotFound();
|
||
$this->actingAs($admin)->get('/termine')->assertNotFound();
|
||
$this->actingAs($admin)->get('/admin/neuigkeiten')->assertNotFound();
|
||
}
|
||
}
|