- Route admin/inventory/guide (superadmin) + NoticeController::guide() - NoticeController auf gemeinsamen Markdown-Renderer umgestellt (Titel/Untertitel parametrisiert, View wiederverwendet) - Sidenav: „Leitfaden" unter Einstellungen neben „Hinweise" - resources/docs/testleitfaden.md eingecheckt; Tests ergänzt Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
58 lines
1.6 KiB
PHP
58 lines
1.6 KiB
PHP
<?php
|
|
|
|
use App\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
uses(TestCase::class, RefreshDatabase::class);
|
|
|
|
function noticeUser(int $adminLevel = 8): User
|
|
{
|
|
$user = User::query()->create([
|
|
'email' => uniqid('notice_', true).'@test.example',
|
|
'password' => bcrypt('password'),
|
|
]);
|
|
$user->forceFill([
|
|
'admin' => $adminLevel,
|
|
'confirmed' => true,
|
|
'active' => true,
|
|
'wizard' => 100,
|
|
'blocked' => false,
|
|
])->save();
|
|
|
|
return $user->fresh();
|
|
}
|
|
|
|
test('hinweise-seite rendert das markdown gerendert als html', function () {
|
|
$this->actingAs(noticeUser(8), 'user');
|
|
|
|
$response = $this->get(route('admin.inventory.notices'));
|
|
|
|
$response->assertSuccessful();
|
|
$response->assertSee('Hinweise');
|
|
$response->assertSee('Entwicklungsstand', false);
|
|
$response->assertSee('<h2', false);
|
|
});
|
|
|
|
test('nicht-superadmin hat keinen zugriff auf hinweise-seite', function () {
|
|
$this->actingAs(noticeUser(7), 'user');
|
|
|
|
$this->get(route('admin.inventory.notices'))->assertRedirect('/home');
|
|
});
|
|
|
|
test('leitfaden-seite rendert testleitfaden.md als html', function () {
|
|
$this->actingAs(noticeUser(8), 'user');
|
|
|
|
$response = $this->get(route('admin.inventory.guide'));
|
|
|
|
$response->assertSuccessful();
|
|
$response->assertSee('Leitfaden');
|
|
$response->assertSee('Testleitfaden Warenwirtschaft', false);
|
|
$response->assertSee('<h2', false);
|
|
});
|
|
|
|
test('nicht-superadmin hat keinen zugriff auf leitfaden-seite', function () {
|
|
$this->actingAs(noticeUser(7), 'user');
|
|
|
|
$this->get(route('admin.inventory.guide'))->assertRedirect('/home');
|
|
});
|