Loheide-eu-mitarbeiterplatt.../tests/Unit/IconsTest.php
Friederich Loheide 23c36d28b5
All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m47s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m33s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 2m41s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m41s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 3m41s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 3m44s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 3m18s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 3m9s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m0s
Menü: Symbole je Menüpunkt, gemeinsame Symbolauswahl
- Optionales Symbol für jeden Menü- und Unterpunkt (Kopfzeile,
  Aufklappmenüs, „Mehr“, Handy-Menü)
- Gemeinsame Liste resources/icons/icons.json (66 Lucide-Symbole) für
  Menü, Schnellzugriffe und Pagebuilder; `npm run icons` erzeugt
  Frontend-Zuordnung und SVGs für die Vorschau im Admin
- Admin-Auswahl mit Symbolvorschau und Suche

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 14:14:52 +00:00

40 lines
1.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace Tests\Unit;
use App\Support\Icons;
use Tests\TestCase;
/**
* Liste, SVG-Daten und Frontend-Zuordnung müssen zusammenpassen
* (nach Änderungen an resources/icons/icons.json: npm run icons).
*/
class IconsTest extends TestCase
{
public function test_generated_files_match_the_list(): void
{
$names = array_keys(Icons::choices());
$svg = require resource_path('icons/svg.php');
$js = file_get_contents(resource_path('js/lib/icons.js'));
$this->assertSame($names, array_keys($svg), 'resources/icons/svg.php veraltet – npm run icons');
foreach ($names as $name) {
$this->assertStringContainsString("'{$name}':", $js, "icons.js ohne „{$name}“ – npm run icons");
$this->assertNotSame('', $svg[$name]);
}
// Bereits gespeicherte Schnellzugriffe nutzen diese Namen.
foreach (['link', 'building-2', 'heart-handshake', 'utensils'] as $legacy) {
$this->assertTrue(Icons::has($legacy));
}
}
public function test_options_are_safe_html_and_searchable(): void
{
$this->assertStringContainsString('<svg', Icons::options()['house']);
$this->assertArrayHasKey('house', Icons::search('startseite'));
$this->assertArrayNotHasKey('house', Icons::search('path'), 'Suche trifft nicht das SVG-Markup');
$this->assertFalse(Icons::has('<script>'));
}
}