NavigationTest.php
Pfad: tests/NavigationTest.php
Ext: php
Größe: 1326 Bytes
Geändert: 2026-07-16 10:05:28+02
<?php
declare(strict_types=1);
namespace Tests;
use Demo\Infrastructure\Http\Navigation;
use PHPUnit\Framework\TestCase;
/**
* Sichert die zentrale Bereichsliste, die Kopfnavigation und Startseiten-Tabelle speist.
*/
final class NavigationTest extends TestCase
{
/**
* Registriert den Autoloader vor jedem Testfall.
*/
protected function setUp(): void
{
$root = dirname(__DIR__);
require_once $root . '/src/Autoloader.php';
(new \Demo\Autoloader($root . '/src'))->register();
}
/**
* Die Bereichsliste enthaelt Dokumentation mit Pfad /doku.
*/
public function testEnthaeltDokumentation(): void
{
$items = (new Navigation())->items();
$treffer = array_filter($items, static fn (array $i): bool => $i['href'] === '/doku');
self::assertCount(1, $treffer);
self::assertSame('Dokumentation', array_values($treffer)[0]['label']);
}
/**
* Die Bereichsliste enthaelt die neue Code-Ansicht.
*/
public function testEnthaeltCode(): void
{
$items = (new Navigation())->items();
$treffer = array_filter($items, static fn (array $i): bool => $i['href'] === '/code');
self::assertCount(1, $treffer);
self::assertSame('Code', array_values($treffer)[0]['label']);
}
}