Beiträge mit dem Baukasten der Seiten, Galerie-Großansicht mit Blättern
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m42s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 4m3s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m32s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m9s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m41s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 6m5s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m57s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m59s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m35s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-26 19:43:05 +00:00
parent 3b72b5327e
commit bdd21a38cb
164 changed files with 1276 additions and 623 deletions

View file

@ -6,7 +6,6 @@ use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Inhaus\Plugins\Events\Filament\Resources\Events\Pages\CreateEvent;
use Inhaus\Plugins\Events\Models\Event;
use Inhaus\Plugins\News\Filament\Resources\NewsPosts\Pages\CreateNewsPost;
use Inhaus\Plugins\News\Models\NewsCategory;
use Inhaus\Plugins\News\Models\NewsPost;
use Livewire\Livewire;
@ -22,10 +21,15 @@ class ContentAdminTest extends TestCase
$post = NewsPost::factory()->create();
$event = Event::factory()->create();
foreach (['/admin/neuigkeiten', '/admin/neuigkeiten/neu', "/admin/neuigkeiten/{$post->id}/bearbeiten", '/admin/kategorien', '/admin/termine', '/admin/termine/neu', "/admin/termine/{$event->id}/bearbeiten"] as $url) {
foreach (['/admin/neuigkeiten', '/admin/kategorien', '/admin/termine', '/admin/termine/neu', "/admin/termine/{$event->id}/bearbeiten"] as $url) {
$this->actingAs($admin)->get($url)->assertOk();
$this->actingAs(User::factory()->create())->get($url)->assertForbidden();
}
// Beiträge schreibt man im Baukasten-Editor des Portals – das Backend leitet dorthin
$this->actingAs($admin)->get('/admin/neuigkeiten/neu')->assertRedirect(route('news.editor.create'));
$this->actingAs($admin)->get("/admin/neuigkeiten/{$post->id}/bearbeiten")->assertRedirect(route('news.editor.edit', $post));
$this->actingAs(User::factory()->create())->get("/admin/neuigkeiten/{$post->id}/bearbeiten")->assertForbidden();
}
public function test_admin_can_write_a_post(): void
@ -34,20 +38,28 @@ class ContentAdminTest extends TestCase
$category = NewsCategory::factory()->create();
$this->actingAs($admin);
Livewire::test(CreateNewsPost::class)
->fillForm([
'title' => 'Neue Kantine eröffnet',
'teaser' => 'Ab Montag gibt es frisches Essen im Erdgeschoss.',
'category_id' => $category->id,
'published_at' => now()->subMinute()->format('Y-m-d H:i'),
])
->call('create')
->assertHasNoFormErrors();
$this->post('/redaktion/neuigkeiten', [
'title' => 'Neue Kantine eröffnet',
'teaser' => 'Ab Montag gibt es frisches Essen im Erdgeschoss.',
'category_id' => $category->id,
'content' => json_encode(['blocks' => [
['type' => 'heading', 'data' => ['text' => 'Was es gibt']],
['type' => 'text', 'data' => ['html' => '<p>Suppe, Salat und <strong>zwei Hauptgerichte</strong>.</p><script>alert(1)</script>']],
]]),
'action' => 'publish',
])->assertSessionHasNoErrors();
$post = NewsPost::query()->firstOrFail();
$this->assertSame('neue-kantine-eroeffnet', $post->slug);
$this->assertSame($admin->id, $post->author_id);
$this->assertTrue($post->isPublished());
$this->assertSame(['heading', 'text'], array_column($post->content['blocks'], 'type'));
$this->assertStringNotContainsString('script', json_encode($post->content));
$this->assertStringContainsString('zwei Hauptgerichte', $post->body, 'Text für Suche und Lesezeit');
$this->get("/neuigkeiten/{$post->slug}")->assertOk()->assertInertia(fn ($page) => $page
->where('post.body_html', null)
->where('content.blocks.1.data.html', fn ($html) => str_contains($html, 'zwei Hauptgerichte')));
}
public function test_admin_can_create_an_event(): void