Detect local audio URLs in MediaUrlResolver
Recognizes mp3/wav/ogg/m4a and emits <audio controls class="kb-audio">. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -67,4 +67,24 @@ public function test_video_url_is_html_escaped(): void
|
||||
$this->assertStringNotContainsString('"quote.mp4"', $html);
|
||||
$this->assertStringContainsString('"', $html);
|
||||
}
|
||||
|
||||
#[DataProvider('audioUrls')]
|
||||
public function test_audio_urls_produce_audio_tag(string $url): void
|
||||
{
|
||||
$html = $this->resolver->resolve($url);
|
||||
$this->assertNotNull($html);
|
||||
$this->assertStringStartsWith('<audio', $html);
|
||||
$this->assertStringContainsString('controls', $html);
|
||||
$this->assertStringContainsString('class="kb-audio"', $html);
|
||||
}
|
||||
|
||||
public static function audioUrls(): array
|
||||
{
|
||||
return [
|
||||
'mp3' => ['/clip.mp3'],
|
||||
'wav' => ['/clip.wav'],
|
||||
'ogg' => ['/clip.ogg'],
|
||||
'm4a' => ['/clip.m4a'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user