28 lines
905 B
PHP
28 lines
905 B
PHP
<?php
|
|
|
|
use App\Models\Tenant;
|
|
use App\Models\User;
|
|
use function Pest\Laravel\actingAs;
|
|
use function Pest\Laravel\get;
|
|
|
|
uses(\Illuminate\Foundation\Testing\RefreshDatabase::class);
|
|
|
|
it('blockt school-admin-Route für child-Rolle', function () {
|
|
$child = User::factory()->withRole('child')->create();
|
|
actingAs($child)->get('/school/dashboard')->assertForbidden();
|
|
});
|
|
|
|
it('erlaubt school-admin-Route für teacher (OR-Semantik)', function () {
|
|
$teacher = User::factory()->withRole('teacher')->create();
|
|
actingAs($teacher)->get('/school/dashboard')->assertOk();
|
|
});
|
|
|
|
it('erlaubt school-admin-Route für school-admin (OR-Semantik)', function () {
|
|
$admin = User::factory()->withRole('school-admin')->create();
|
|
actingAs($admin)->get('/school/dashboard')->assertOk();
|
|
});
|
|
|
|
it('redirected Unauthenticated to login', function () {
|
|
get('/school/dashboard')->assertRedirect('/login');
|
|
});
|