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
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:
parent
3b72b5327e
commit
bdd21a38cb
164 changed files with 1276 additions and 623 deletions
|
|
@ -7,8 +7,6 @@ use App\Models\User;
|
|||
use Filament\Actions\Testing\TestAction;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Inhaus\Plugins\News\Filament\Resources\NewsCategories\Pages\ManageNewsCategories;
|
||||
use Inhaus\Plugins\News\Filament\Resources\NewsPosts\Pages\CreateNewsPost;
|
||||
use Inhaus\Plugins\News\Filament\Resources\NewsPosts\Pages\EditNewsPost;
|
||||
use Inhaus\Plugins\News\Filament\Resources\NewsPosts\Pages\ListNewsPosts;
|
||||
use Inhaus\Plugins\News\Models\NewsCategory;
|
||||
use Inhaus\Plugins\News\Models\NewsPost;
|
||||
|
|
@ -61,19 +59,20 @@ class MavScenarioTest extends TestCase
|
|||
public function test_mav_can_write_in_its_category_but_publishing_needs_the_publish_right(): void
|
||||
{
|
||||
$this->actingAs($this->mav);
|
||||
$data = [
|
||||
'title' => 'Einladung zur Mitarbeiterversammlung',
|
||||
'category_id' => $this->mavCategory->id,
|
||||
'published_at' => now()->subMinute()->toIso8601String(),
|
||||
'is_featured' => true,
|
||||
'content' => json_encode(['blocks' => [['type' => 'text', 'data' => ['html' => '<p>Am Donnerstag …</p>']]]]),
|
||||
];
|
||||
|
||||
Livewire::test(CreateNewsPost::class)
|
||||
->fillForm([
|
||||
'title' => 'Einladung zur Mitarbeiterversammlung',
|
||||
'category_id' => $this->mavCategory->id,
|
||||
'published_at' => now()->subMinute()->format('Y-m-d H:i'),
|
||||
'is_featured' => true,
|
||||
])
|
||||
->call('create')
|
||||
->assertHasNoFormErrors();
|
||||
$this->post('/redaktion/neuigkeiten', [...$data, 'action' => 'publish'])->assertSessionHasErrors('action');
|
||||
$this->post('/redaktion/neuigkeiten', [...$data, 'action' => 'submit'])->assertSessionHasNoErrors();
|
||||
|
||||
$post = NewsPost::query()->sole();
|
||||
$this->assertNull($post->published_at, 'Ohne Veröffentlichungsrecht bleibt der Beitrag ein Entwurf.');
|
||||
$this->assertFalse($post->isPublished(), 'Ohne Veröffentlichungsrecht geht der Beitrag zur Freigabe.');
|
||||
$this->assertSame(NewsPost::PENDING, $post->status);
|
||||
$this->assertFalse($post->is_featured);
|
||||
$this->assertSame($this->mav->id, $post->author_id);
|
||||
}
|
||||
|
|
@ -83,14 +82,12 @@ class MavScenarioTest extends TestCase
|
|||
Role::query()->where('name', 'MAV')->sole()->grants()->create(['ability' => 'news.post.publish', 'resource_type' => 'news_category', 'resource_id' => $this->mavCategory->id]);
|
||||
$this->actingAs($this->mav->fresh());
|
||||
|
||||
Livewire::test(CreateNewsPost::class)
|
||||
->fillForm([
|
||||
'title' => 'Ergebnisse der MAV-Wahl',
|
||||
'category_id' => $this->mavCategory->id,
|
||||
'published_at' => now()->subMinute()->format('Y-m-d H:i'),
|
||||
])
|
||||
->call('create')
|
||||
->assertHasNoFormErrors();
|
||||
$this->post('/redaktion/neuigkeiten', [
|
||||
'title' => 'Ergebnisse der MAV-Wahl',
|
||||
'category_id' => $this->mavCategory->id,
|
||||
'content' => json_encode(['blocks' => []]),
|
||||
'action' => 'publish',
|
||||
])->assertSessionHasNoErrors();
|
||||
|
||||
$this->assertTrue(NewsPost::query()->sole()->isPublished());
|
||||
}
|
||||
|
|
@ -99,24 +96,26 @@ class MavScenarioTest extends TestCase
|
|||
{
|
||||
$this->actingAs($this->mav);
|
||||
|
||||
Livewire::test(CreateNewsPost::class)
|
||||
->fillForm(['title' => 'Fremd', 'category_id' => $this->otherCategory->id])
|
||||
->call('create')
|
||||
->assertHasFormErrors(['category_id']);
|
||||
$this->post('/redaktion/neuigkeiten', ['title' => 'Fremd', 'category_id' => $this->otherCategory->id, 'action' => 'draft'])
|
||||
->assertSessionHasErrors('category_id');
|
||||
$this->assertSame(0, NewsPost::query()->count());
|
||||
|
||||
$foreign = NewsPost::factory()->create(['category_id' => $this->otherCategory->id]);
|
||||
$this->get("/admin/neuigkeiten/{$foreign->id}/bearbeiten")->assertNotFound();
|
||||
$this->get("/redaktion/neuigkeiten/{$foreign->id}")->assertForbidden();
|
||||
}
|
||||
|
||||
public function test_editing_without_publish_right_does_not_change_publication(): void
|
||||
{
|
||||
$post = NewsPost::factory()->create(['category_id' => $this->mavCategory->id, 'published_at' => null]);
|
||||
$post = NewsPost::factory()->draft()->create(['category_id' => $this->mavCategory->id, 'author_id' => $this->mav->id]);
|
||||
$this->actingAs($this->mav);
|
||||
|
||||
Livewire::test(EditNewsPost::class, ['record' => $post->getRouteKey()])
|
||||
->fillForm(['title' => 'Überarbeitet', 'published_at' => now()->format('Y-m-d H:i')])
|
||||
->call('save')
|
||||
->assertHasNoFormErrors();
|
||||
$this->put("/redaktion/neuigkeiten/{$post->id}", [
|
||||
'title' => 'Überarbeitet',
|
||||
'category_id' => $this->mavCategory->id,
|
||||
'published_at' => now()->toIso8601String(),
|
||||
'action' => 'draft',
|
||||
])->assertSessionHasNoErrors();
|
||||
|
||||
$post->refresh();
|
||||
$this->assertSame('Überarbeitet', $post->title);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue