Some checks failed
Deploy Application / deploy (push) Has been cancelled
69 lines
1.7 KiB
PHP
69 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit\Framework\LiveComponents\Attributes;
|
|
|
|
use App\Framework\LiveComponents\Attributes\Island;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class IslandTest extends TestCase
|
|
{
|
|
public function test_can_create_island_attribute_with_defaults(): void
|
|
{
|
|
$island = new Island();
|
|
|
|
$this->assertTrue($island->isolated);
|
|
$this->assertFalse($island->lazy);
|
|
$this->assertNull($island->placeholder);
|
|
}
|
|
|
|
public function test_can_create_island_attribute_with_custom_values(): void
|
|
{
|
|
$island = new Island(
|
|
isolated: true,
|
|
lazy: true,
|
|
placeholder: 'Loading widget...'
|
|
);
|
|
|
|
$this->assertTrue($island->isolated);
|
|
$this->assertTrue($island->lazy);
|
|
$this->assertSame('Loading widget...', $island->placeholder);
|
|
}
|
|
|
|
public function test_can_create_non_isolated_island(): void
|
|
{
|
|
$island = new Island(isolated: false);
|
|
|
|
$this->assertFalse($island->isolated);
|
|
$this->assertFalse($island->lazy);
|
|
$this->assertNull($island->placeholder);
|
|
}
|
|
|
|
public function test_can_create_lazy_island_without_placeholder(): void
|
|
{
|
|
$island = new Island(lazy: true);
|
|
|
|
$this->assertTrue($island->isolated);
|
|
$this->assertTrue($island->lazy);
|
|
$this->assertNull($island->placeholder);
|
|
}
|
|
|
|
public function test_can_create_lazy_island_with_placeholder(): void
|
|
{
|
|
$island = new Island(
|
|
lazy: true,
|
|
placeholder: 'Please wait...'
|
|
);
|
|
|
|
$this->assertTrue($island->isolated);
|
|
$this->assertTrue($island->lazy);
|
|
$this->assertSame('Please wait...', $island->placeholder);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|