cms/tests/Feature/AccessibilityAnalyzerTest.php
Funky Waddle 37ed997989 feat(cms): initialize Laravel project structure and core CMS files
- Added standard Laravel directory structure and configuration.

- Included Svelte and Tailwind configuration for the admin interface.

- Added core PHPUnit and testing scripts.
2026-04-13 12:48:06 -05:00

38 lines
1.1 KiB
PHP

<?php
namespace Tests\Feature;
use App\Services\AccessibilityAnalyzer;
use Tests\TestCase;
class AccessibilityAnalyzerTest extends TestCase
{
public function test_analyzer_detects_missing_alt_tags(): void
{
$analyzer = new AccessibilityAnalyzer();
$content = [
['type' => 'image', 'data' => ['url' => 'test.jpg']], // missing alt
['type' => 'image', 'data' => ['url' => 'test2.jpg', 'alt' => 'Descriptive text']],
];
$issues = $analyzer->analyze($content);
$this->assertCount(1, $issues);
$this->assertEquals('Image block is missing alternative text (alt tag).', $issues[0]['message']);
}
public function test_analyzer_detects_heading_skips(): void
{
$analyzer = new AccessibilityAnalyzer();
$content = [
['type' => 'heading', 'data' => ['level' => 1]],
['type' => 'heading', 'data' => ['level' => 3]], // skipped H2
];
$issues = $analyzer->analyze($content);
$this->assertCount(1, $issues);
$this->assertStringContainsString('Skipped heading level', $issues[0]['message']);
}
}