Redaktion mit Bereichsleiste und Übersicht (0.42.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 6m51s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 6m48s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 7m16s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 7m21s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 9m30s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 9m44s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 8m49s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 8m37s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 44s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m8s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-27 18:38:44 +00:00
parent b1209a0d33
commit d5b7b1e0a8
146 changed files with 666 additions and 362 deletions

View file

@ -0,0 +1,51 @@
<?php
namespace Tests\Feature;
use App\Editorial\Editorial;
use App\Models\Role;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Inertia\Testing\AssertableInertia as Assert;
use Tests\TestCase;
class EditorialAreasTest extends TestCase
{
use RefreshDatabase;
public function test_overview_lists_areas_with_icons_todos_and_create_links(): void
{
$admin = User::factory()->admin()->create();
$this->actingAs($admin)->get('/redaktion')->assertOk()->assertInertia(fn (Assert $p) => $p
->component('Editorial/Index')
->where('section', null)
->where('areas', fn ($areas) => collect($areas)->every(fn ($a) => filled($a['icon']))
&& collect($areas)->firstWhere('key', 'news')['create']['href'] === route('news.editor.create')
&& collect($areas)->firstWhere('key', 'media')['icon'] === 'images'));
}
public function test_single_area_and_unknown_or_forbidden_areas(): void
{
$role = Role::query()->create(['name' => 'Termine']);
$role->grants()->create(['ability' => 'events.manage']);
$user = User::factory()->withRoles([$role])->create();
$this->actingAs($user)->get('/redaktion?bereich=events')->assertOk()->assertInertia(fn (Assert $p) => $p->where('section.key', 'events')->where('active', 'events'));
$this->actingAs($user)->get('/redaktion?bereich=news')->assertNotFound();
$this->actingAs($user)->get('/redaktion?bereich=gibt-es-nicht')->assertNotFound();
}
public function test_plugins_without_meta_get_a_default_icon_and_failing_todos_are_ignored(): void
{
$editorial = app(Editorial::class);
$editorial->add('kleinanzeigen', 'Kleinanzeigen', 'x::Y', 50, fn () => true, fn () => []);
$editorial->add('eigenes', 'Eigenes', 'x::Z', 51, fn () => true, fn () => []);
$editorial->meta('eigenes', todo: fn () => throw new \RuntimeException('kaputt'));
$areas = collect($editorial->menu(User::factory()->create()))->keyBy('key');
$this->assertSame('shopping-bag', $areas['kleinanzeigen']['icon']);
$this->assertSame('layout-grid', $areas['eigenes']['icon']);
$this->assertNull($areas['eigenes']['todo']);
}
}

View file

@ -304,8 +304,8 @@ class FormsTest extends TestCase
$this->actingAs(User::factory()->withRoles([$editors])->create())->get(route('forms.builder', $form))->assertOk()
->assertInertia(fn (Assert $p) => $p->where('resultsUrl', null));
$this->get('/redaktion')->assertInertia(fn (Assert $p) => $p->where('sections', fn ($sections) => collect($sections)->contains(fn ($s) => $s['key'] === 'forms'
&& $s['props']['forms'][0]['builder_url'] !== null && $s['props']['forms'][0]['csv_url'] === null)));
$this->get('/redaktion?bereich=forms')->assertInertia(fn (Assert $p) => $p->where('section.key', 'forms')
->where('section.props.forms.0.builder_url', fn ($url) => $url !== null)->where('section.props.forms.0.csv_url', null));
}
public function test_selected_results_can_be_downloaded_as_csv(): void

View file

@ -91,8 +91,10 @@ class NewsWorkflowTest extends TestCase
$this->actingAs($employee)->get('/neuigkeiten/'.$post->slug)->assertNotFound();
$this->actingAs($this->editor)->get('/redaktion')->assertInertia(fn (Assert $p) => $p
->where('sections.0.key', 'news')
->where('sections.0.props.review.0.title', 'Mitarbeiterversammlung'));
->where('areas.0.key', 'news')->where('areas.0.todo.count', 1)->where('section', null));
$this->actingAs($this->editor)->get('/redaktion?bereich=news')->assertInertia(fn (Assert $p) => $p
->where('section.key', 'news')
->where('section.props.review.0.title', 'Mitarbeiterversammlung'));
$this->post('/redaktion/neuigkeiten/'.$post->id.'/freigeben')->assertRedirect('/redaktion');
$post->refresh();
@ -121,7 +123,7 @@ class NewsWorkflowTest extends TestCase
$this->assertSame('Bitte Ort ergänzen.', $post->review_note);
Notification::assertSentTo($this->author, PortalNotification::class, fn ($n) => str_contains($n->body, 'Bitte Ort ergänzen.'));
$this->actingAs($this->author)->get('/redaktion')->assertInertia(fn (Assert $p) => $p->where('sections.0.props.mine.0.review_note', 'Bitte Ort ergänzen.'));
$this->actingAs($this->author)->get('/redaktion?bereich=news')->assertInertia(fn (Assert $p) => $p->where('section.props.mine.0.review_note', 'Bitte Ort ergänzen.'));
$this->post('/redaktion/neuigkeiten/'.$post->id.'/freigeben')->assertForbidden();
}
@ -138,7 +140,7 @@ class NewsWorkflowTest extends TestCase
$this->assertTrue($post->is_featured);
$this->assertFalse($post->isPublished());
$this->get('/redaktion')->assertInertia(fn (Assert $p) => $p->where('sections.0.props.mine.0.status_label', 'Geplant'));
$this->get('/redaktion?bereich=news')->assertInertia(fn (Assert $p) => $p->where('section.props.mine.0.status_label', 'Geplant'));
$this->travel(3)->days();
$this->assertTrue($post->fresh()->isPublished());

View file

@ -45,7 +45,7 @@ class PagesAdminTest extends TestCase
// Die MAV pflegt ihre Seiten in der Redaktion des Portals, nicht im Backend
$this->actingAs($member)->get('/admin/seiten')->assertForbidden();
$this->get('/redaktion')->assertInertia(fn ($p) => $p->where('sections', fn ($sections) => count(collect($sections)->firstWhere('key', 'pages')['props']['pages']) === 2));
$this->get('/redaktion?bereich=pages')->assertInertia(fn ($p) => $p->where('section.props.pages', fn ($pages) => count($pages) === 2));
$this->assertTrue($member->can('publish', $child));
}

View file

@ -126,9 +126,9 @@ class PagesTest extends TestCase
$this->putJson('/redaktion/seiten/'.$other->id.'/entwurf', ['title' => 'x', 'content' => $this->content()])->assertForbidden();
$this->post('/redaktion/seiten', ['title' => 'Oberste Ebene'])->assertForbidden();
$this->get('/redaktion')->assertOk()->assertInertia(fn (Assert $p) => $p
->where('sections.0.key', 'pages')
->where('sections.0.props.pages', fn ($pages) => collect($pages)->pluck('title')->sort()->values()->all() === ['MAV', 'Wahlen']));
$this->get('/redaktion?bereich=pages')->assertOk()->assertInertia(fn (Assert $p) => $p
->where('section.key', 'pages')
->where('section.props.pages', fn ($pages) => collect($pages)->pluck('title')->sort()->values()->all() === ['MAV', 'Wahlen']));
$this->get('/seiten/mav')->assertInertia(fn (Assert $p) => $p->where('editor.url', route('pages.editor', $mavPage)));
$this->get('/seiten/geschaeftsfuehrung')->assertInertia(fn (Assert $p) => $p->where('editor', null));

View file

@ -48,9 +48,8 @@ class MavScenarioTest extends TestCase
$this->actingAs($this->mav)->get('/admin/neuigkeiten')->assertForbidden();
$this->get('/')->assertInertia(fn ($page) => $page->where('auth.user.can_admin', false));
$this->get('/redaktion')->assertOk()->assertInertia(fn ($page) => $page
->where('sections', fn ($sections) => collect($sections)->firstWhere('key', 'news')['props']['published'][0]['title'] === 'MAV-Sprechstunde'
&& count(collect($sections)->firstWhere('key', 'news')['props']['published']) === 1));
$this->get('/redaktion?bereich=news')->assertOk()->assertInertia(fn ($page) => $page
->where('section.props.published', fn ($published) => count($published) === 1 && $published[0]['title'] === 'MAV-Sprechstunde'));
}
public function test_mav_cannot_manage_categories_or_other_sections(): void