Reine Redaktionsrechte öffnen nicht mehr das Backend (0.25.1)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 4m6s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 4m20s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 5m17s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 5m18s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 7m10s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 6m41s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 5m44s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 5m59s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m51s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 4m6s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 4m20s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 5m17s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 5m18s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 7m10s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 6m41s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 5m44s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 5m59s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m51s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
4d155457b8
commit
34d6cdbf1c
121 changed files with 371 additions and 318 deletions
|
|
@ -7,7 +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\ListNewsPosts;
|
||||
use Inhaus\Plugins\News\Models\NewsCategory;
|
||||
use Inhaus\Plugins\News\Models\NewsPost;
|
||||
use Livewire\Livewire;
|
||||
|
|
@ -39,14 +38,19 @@ class MavScenarioTest extends TestCase
|
|||
$this->mav = User::factory()->withRoles([$role])->create();
|
||||
}
|
||||
|
||||
public function test_mav_sees_only_its_own_posts_in_admin(): void
|
||||
public function test_mav_works_in_the_portal_only_and_sees_its_own_category(): void
|
||||
{
|
||||
$own = NewsPost::factory()->create(['category_id' => $this->mavCategory->id, 'title' => 'MAV-Sprechstunde']);
|
||||
NewsPost::factory()->create(['category_id' => $this->otherCategory->id, 'title' => 'Quartalszahlen']);
|
||||
NewsPost::factory()->create(['category_id' => $this->mavCategory->id, 'title' => 'MAV-Sprechstunde', 'published_at' => now()->subDay()]);
|
||||
NewsPost::factory()->create(['category_id' => $this->otherCategory->id, 'title' => 'Quartalszahlen', 'published_at' => now()->subDay()]);
|
||||
|
||||
$this->actingAs($this->mav)->get('/admin/neuigkeiten')->assertOk()->assertSee('MAV-Sprechstunde')->assertDontSee('Quartalszahlen');
|
||||
// Redaktionsrechte öffnen nicht das Backend
|
||||
$this->assertFalse($this->mav->canAccessAdmin());
|
||||
$this->actingAs($this->mav)->get('/admin/neuigkeiten')->assertForbidden();
|
||||
$this->get('/')->assertInertia(fn ($page) => $page->where('auth.user.can_admin', false));
|
||||
|
||||
Livewire::actingAs($this->mav)->test(ListNewsPosts::class)->assertCanSeeTableRecords([$own])->assertCountTableRecords(1);
|
||||
$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));
|
||||
}
|
||||
|
||||
public function test_mav_cannot_manage_categories_or_other_sections(): void
|
||||
|
|
@ -101,7 +105,7 @@ class MavScenarioTest extends TestCase
|
|||
$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("/admin/neuigkeiten/{$foreign->id}/bearbeiten")->assertForbidden();
|
||||
$this->get("/redaktion/neuigkeiten/{$foreign->id}")->assertForbidden();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue