34 lines
868 B
PHP
34 lines
868 B
PHP
<?php
|
|
|
|
namespace Tests\Unit;
|
|
|
|
use App\Domain\Cms\Blocks\BlockRegistry;
|
|
use Illuminate\Validation\ValidationException;
|
|
use Tests\TestCase;
|
|
|
|
class BlockRegistryTest extends TestCase
|
|
{
|
|
public function test_image_text_requires_an_alternative_text(): void
|
|
{
|
|
$this->expectException(ValidationException::class);
|
|
|
|
app(BlockRegistry::class)->normalize([
|
|
['type' => 'image_text', 'body' => 'Text', 'image' => 'cms/bild.jpg'],
|
|
]);
|
|
}
|
|
|
|
public function test_action_links_reject_script_urls(): void
|
|
{
|
|
$this->expectException(ValidationException::class);
|
|
|
|
app(BlockRegistry::class)->normalize([
|
|
[
|
|
'type' => 'call_to_action',
|
|
'heading' => 'Weiter',
|
|
'label' => 'Öffnen',
|
|
'url' => 'javascript:alert(1)',
|
|
],
|
|
]);
|
|
}
|
|
}
|