Merge remote-tracking branch 'origin/develop' into feature/uebungen-uebernahme-zugang
Deploy Test / test (push) Successful in 2m27s
CI Feature / test (push) Successful in 2m37s
Deploy Test / deploy (push) Successful in 29s

This commit is contained in:
Lars committed 2026-11-23 17:25:48 +01:00
commit bcda189267
124 files changed
+839 -2

No files matched your search

+3 -1
View File
@@ -188,7 +188,9 @@ public function test_media_card_is_public_only_as_part_of_a_public_program_and_n
// Material: eigene Darstellung mit Materialsymbol.
$this->assertStringContainsString('lf-pc lf-pc--material', $main);
$this->assertStringContainsString('lf-pc__panel lf-pc__panel--material', $main);
$this->assertStringContainsString('<p class="lf-pc__kind">Merkblatt</p>', $main);
// Ausgabeklasse pdf: die Art steht als PDF-Tag, die Beschriftung bleibt die redaktionelle Art.
$this->assertStringContainsString('brand-tag brand-tag--pdf', $main);
$this->assertMatchesRegularExpression('#<span class="brand-tag__text">\s*Merkblatt\s*</span>#', $main);
$this->assertStringContainsString('Ein Blatt für Eltern.', $main);
// Vertraulich und nicht öffentlich genannt: öffentlich nicht sichtbar.
$this->assertStringNotContainsString('Traineranleitung Abstand', $main, 'Traineranleitungen erscheinen nie öffentlich.');
@@ -84,6 +84,19 @@ public function test_a_released_website_film_shows_publicly_with_its_clip_and_wi
$this->assertStringNotContainsString('originals/', $html);
}
public function test_a_film_card_shows_its_kind_as_a_film_tag_with_text(): void
{
$teaser = $this->websiteFilm('Teaser Denkpause');
$this->release($teaser);
$this->publish('/teaser-tag', $teaser);
$html = $this->get('/teaser-tag')->assertOk()->getContent();
$this->assertStringContainsString('brand-tag brand-tag--film', $html);
$this->assertMatchesRegularExpression('#<span class="brand-tag__text">\s*Film\s*</span>#', $html, 'Das Tag trägt echten Text.');
$this->assertSame(1, substr_count($html, 'lf-pc__kind--tag'));
}
public function test_an_unreleased_website_film_stays_out_of_the_public_page_but_shows_in_the_preview(): void
{
$teaser = $this->websiteFilm('Teaser Denkpause');
+72
View File
@@ -0,0 +1,72 @@
<?php
namespace Tests\Feature;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
/**
* Favicon des Brand-Kits (15_Lara-Felix-Favicon). Der eigentliche Fehler war eine leere public/favicon.ico:
* Browser fragen sie selbst ab und bekamen nichts.
*/
class FaviconTest extends TestCase
{
use RefreshDatabase;
public function test_the_icon_files_are_real_and_not_empty(): void
{
$ico = file_get_contents(public_path('favicon.ico'));
$this->assertGreaterThan(1000, strlen($ico));
$this->assertSame("\x00\x00\x01\x00", substr($ico, 0, 4), 'favicon.ico ist keine ICO-Datei');
$svg = file_get_contents(public_path('favicon.svg'));
$this->assertStringContainsString('<svg', $svg);
$this->assertStringContainsString('Lara &amp; Felix', $svg);
$png = file_get_contents(public_path('apple-touch-icon.png'));
$this->assertSame("\x89PNG", substr($png, 0, 4));
}
public function test_public_pages_link_the_icons(): void
{
$this->get('/')->assertOk()
->assertSee('href="'.asset('favicon.ico').'" sizes="any"', false)
->assertSee('href="'.asset('favicon.svg').'" type="image/svg+xml"', false)
->assertSee('rel="apple-touch-icon" href="'.asset('apple-touch-icon.png').'"', false);
}
public function test_the_sign_in_page_links_the_icons(): void
{
$this->get(route('login'))->assertOk()
->assertSee(asset('favicon.svg'), false);
}
public function test_the_member_area_links_the_icons(): void
{
$this->actingAs(User::factory()->create())
->get(route('member.dashboard'))
->assertOk()
->assertSee(asset('favicon.svg'), false)
->assertSee(asset('apple-touch-icon.png'), false);
}
public function test_the_administration_login_uses_the_favicon(): void
{
$this->get('/verwaltung/login')->assertOk()
->assertSee('rel="icon" href="'.asset('favicon.svg').'"', false)
->assertSee('rel="apple-touch-icon"', false);
}
public function test_the_administration_icon_follows_the_opened_address_behind_a_proxy(): void
{
config(['app.url' => 'https://CHANGE-ME.example']);
$this->withHeaders(['X-Forwarded-Host' => '', 'X-Forwarded-Port' => '', 'X-Forwarded-Proto' => ''])
->get('http://192.168.2.144:3011/verwaltung/login')
->assertOk()
->assertSee('href="http://192.168.2.144:3011/favicon.svg"', false)
->assertSee('href="http://192.168.2.144:3011/apple-touch-icon.png"', false)
->assertDontSee('CHANGE-ME.example');
}
}
+77
View File
@@ -0,0 +1,77 @@
<?php
namespace Tests\Unit;
use App\Support\Brand\Symbols;
use Illuminate\Support\Facades\Blade;
use InvalidArgumentException;
use Tests\TestCase;
/**
* Kleingrafiken des Brand-Kits (resources/svg/brand): vollständig, ohne doppelte IDs, rein dekorativ.
*/
class BrandSymbolsTest extends TestCase
{
public function test_every_kit_symbol_is_available_and_every_name_renders(): void
{
$expected = [
'bildung', 'buch', 'download', 'filmklappe', 'filmstreifen', 'gelbe-unterstreichung', 'gruppe', 'merkblatt',
'muskelarm', 'paket', 'pause-hand', 'play', 'schutzschild', 'signalstrahlen', 'sprechblase-fragezeichen', 'uebungsblatt',
];
$this->assertSame($expected, Symbols::names());
foreach (Symbols::names() as $name) {
$this->assertStringStartsWith('<svg aria-hidden="true" focusable="false"', (string) Symbols::symbol($name), $name);
}
foreach (Symbols::names(Symbols::SET_GLYPHS) as $name) {
$this->assertStringContainsString('currentColor', (string) Symbols::glyph($name), $name);
}
}
public function test_the_kit_ids_titles_and_fixed_sizes_are_removed_so_several_symbols_do_not_clash(): void
{
$html = Blade::render('<x-brand.symbol name="filmklappe" /><x-brand.symbol name="buch" /><x-brand.symbol name="paket" />');
$this->assertStringNotContainsString('motif-title', $html);
$this->assertStringNotContainsString('<title', $html);
$this->assertStringNotContainsString('aria-labelledby', $html);
$this->assertStringNotContainsString('role="img"', $html);
$this->assertDoesNotMatchRegularExpression('/<svg[^>]*\s(?:width|height)=/', $html, 'Keine feste Größe am Wurzelelement.');
$this->assertSame(3, substr_count($html, 'aria-hidden="true"'));
$this->assertSame(3, substr_count($html, 'class="brand-symbol"'));
$this->assertSame(3, substr_count($html, 'viewBox='));
}
public function test_attributes_of_the_component_are_kept_and_escaped(): void
{
$html = Blade::render('<x-brand.symbol name="play" class="extra" :data-x="$value" />', ['value' => 'a"b']);
$this->assertStringContainsString('class="brand-symbol extra"', $html);
$this->assertStringContainsString('data-x="a&quot;b"', $html);
}
public function test_an_unknown_or_unsafe_name_is_an_error(): void
{
foreach (['gibt-es-nicht', '../symbole/buch', 'Buch', ''] as $name) {
try {
Symbols::symbol($name);
$this->fail("Name „{$name}“ hätte abgewiesen werden müssen.");
} catch (InvalidArgumentException) {
$this->addToAssertionCount(1);
}
}
}
public function test_the_symbol_files_contain_no_text_and_no_scripts(): void
{
foreach ([Symbols::SET_SYMBOLS, Symbols::SET_GLYPHS] as $set) {
foreach (Symbols::names($set) as $name) {
$svg = (string) file_get_contents(resource_path("svg/brand/$set/$name.svg"));
$this->assertDoesNotMatchRegularExpression('/<(text|script|image|foreignObject|style)\b/i', $svg, "$set/$name");
$this->assertDoesNotMatchRegularExpression('/\son\w+=/i', $svg, "$set/$name");
}
}
}
}
+55
View File
@@ -0,0 +1,55 @@
<?php
namespace Tests\Unit;
use App\Domain\Catalog\MaterialTag;
use App\Support\Brand\Symbols;
use Illuminate\Support\Facades\Blade;
use Tests\TestCase;
class MaterialTagTest extends TestCase
{
public function test_the_mapping_follows_keys_not_labels(): void
{
$this->assertSame(MaterialTag::Film, MaterialTag::fromContent('film'));
$this->assertSame(MaterialTag::Pdf, MaterialTag::fromContent('pdf'));
$this->assertSame(MaterialTag::Film, MaterialTag::fromContent('document', 'unterrichtsfilm'));
$this->assertSame(MaterialTag::Film, MaterialTag::fromContent(null, 'trailer'));
$this->assertSame(MaterialTag::Uebung, MaterialTag::fromContent('document', 'arbeitsblatt'));
$this->assertSame(MaterialTag::Uebung, MaterialTag::fromContent(null, 'uebungsbeschreibung'));
}
public function test_what_is_not_clear_gets_no_tag(): void
{
$this->assertNull(MaterialTag::fromContent('document'), 'Ein Dokument ist nicht automatisch ein PDF.');
$this->assertNull(MaterialTag::fromContent('audio', 'audioanleitung'));
$this->assertNull(MaterialTag::fromContent(null, 'programm'));
$this->assertNull(MaterialTag::fromContent(null, 'modul'));
$this->assertNull(MaterialTag::fromContent(null, null));
$this->assertNull(MaterialTag::fromContent('bild', 'Unterrichtsfilm'), 'Eine Beschriftung ist kein Schlüssel.');
}
public function test_every_tag_has_a_label_and_an_existing_glyph(): void
{
foreach (MaterialTag::cases() as $tag) {
$this->assertNotSame('', $tag->label());
$this->assertContains($tag->glyph(), Symbols::names(Symbols::SET_GLYPHS), $tag->value);
}
}
public function test_the_component_shows_real_text_with_a_decorative_glyph(): void
{
$default = Blade::render('<x-brand.tag kind="film-uebungen" />');
$this->assertStringContainsString('brand-tag brand-tag--film-uebungen', $default);
$this->assertStringContainsString('>Film + Übungen</span>', $default);
$this->assertStringContainsString('aria-hidden="true"', $default);
$custom = Blade::render('<x-brand.tag :kind="$kind">Unterrichtsfilm</x-brand.tag>', ['kind' => MaterialTag::Film]);
$this->assertStringContainsString('brand-tag--film', $custom);
$this->assertStringContainsString('>Unterrichtsfilm</span>', $custom);
$this->assertStringNotContainsString('>Film</span>', $custom, 'Die redaktionelle Art ersetzt die Standardbeschriftung.');
$escaped = Blade::render('<x-brand.tag kind="pdf">{{ $text }}</x-brand.tag>', ['text' => '<b>x</b>']);
$this->assertStringNotContainsString('<b>x</b>', $escaped);
}
}