fix: DockerSecretsResolver - don't normalize absolute paths like /var/www/html/...
Some checks failed
Deploy Application / deploy (push) Has been cancelled
Some checks failed
Deploy Application / deploy (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Application\LiveComponents\Popover;
|
||||
|
||||
use App\Application\LiveComponents\Popover\PopoverComponent;
|
||||
use App\Application\LiveComponents\Popover\PopoverState;
|
||||
use App\Framework\LiveComponents\ValueObjects\ComponentData;
|
||||
use App\Framework\LiveComponents\ValueObjects\ComponentId;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class PopoverComponentTest extends TestCase
|
||||
{
|
||||
public function testPopoverComponentCanBeCreated(): void
|
||||
{
|
||||
$component = new PopoverComponent(
|
||||
id: ComponentId::fromString('popover:test'),
|
||||
isVisible: false,
|
||||
position: 'top',
|
||||
anchorId: 'test-anchor'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(PopoverComponent::class, $component);
|
||||
$this->assertFalse($component->state->isVisible);
|
||||
$this->assertEquals('top', $component->state->position);
|
||||
$this->assertEquals('test-anchor', $component->state->anchorId);
|
||||
}
|
||||
|
||||
public function testShowActionShowsPopover(): void
|
||||
{
|
||||
$component = new PopoverComponent(
|
||||
id: ComponentId::fromString('popover:test')
|
||||
);
|
||||
|
||||
$newState = $component->show('Test Content', 'Test Title', 'test-anchor', 'bottom');
|
||||
|
||||
$this->assertTrue($newState->isVisible);
|
||||
$this->assertEquals('Test Content', $newState->content);
|
||||
$this->assertEquals('Test Title', $newState->title);
|
||||
$this->assertEquals('test-anchor', $newState->anchorId);
|
||||
$this->assertEquals('bottom', $newState->position);
|
||||
}
|
||||
|
||||
public function testHideActionHidesPopover(): void
|
||||
{
|
||||
$component = new PopoverComponent(
|
||||
id: ComponentId::fromString('popover:test'),
|
||||
isVisible: true
|
||||
);
|
||||
|
||||
$newState = $component->hide();
|
||||
|
||||
$this->assertFalse($newState->isVisible);
|
||||
}
|
||||
|
||||
public function testToggleActionTogglesPopover(): void
|
||||
{
|
||||
$component = new PopoverComponent(
|
||||
id: ComponentId::fromString('popover:test'),
|
||||
isVisible: false
|
||||
);
|
||||
|
||||
$visibleState = $component->toggle();
|
||||
$this->assertTrue($visibleState->isVisible);
|
||||
|
||||
// Simulate state update
|
||||
$component = new PopoverComponent(
|
||||
id: ComponentId::fromString('popover:test'),
|
||||
initialData: ComponentData::fromArray($visibleState->toArray())
|
||||
);
|
||||
|
||||
$hiddenState = $component->toggle();
|
||||
$this->assertFalse($hiddenState->isVisible);
|
||||
}
|
||||
|
||||
public function testUpdatePositionActionUpdatesPosition(): void
|
||||
{
|
||||
$component = new PopoverComponent(
|
||||
id: ComponentId::fromString('popover:test'),
|
||||
position: 'top'
|
||||
);
|
||||
|
||||
$newState = $component->updatePosition('right');
|
||||
|
||||
$this->assertEquals('right', $newState->position);
|
||||
}
|
||||
|
||||
public function testUpdateAnchorActionUpdatesAnchor(): void
|
||||
{
|
||||
$component = new PopoverComponent(
|
||||
id: ComponentId::fromString('popover:test'),
|
||||
anchorId: 'old-anchor'
|
||||
);
|
||||
|
||||
$newState = $component->updateAnchor('new-anchor');
|
||||
|
||||
$this->assertEquals('new-anchor', $newState->anchorId);
|
||||
}
|
||||
|
||||
public function testPopoverStateFromArray(): void
|
||||
{
|
||||
$data = [
|
||||
'is_visible' => true,
|
||||
'position' => 'bottom',
|
||||
'anchor_id' => 'test-anchor',
|
||||
'content' => 'Test Content',
|
||||
'title' => 'Test Title',
|
||||
'show_arrow' => true,
|
||||
'offset' => 10,
|
||||
'close_on_outside_click' => true,
|
||||
'z_index' => 1060,
|
||||
];
|
||||
|
||||
$state = PopoverState::fromArray($data);
|
||||
|
||||
$this->assertTrue($state->isVisible);
|
||||
$this->assertEquals('bottom', $state->position);
|
||||
$this->assertEquals('test-anchor', $state->anchorId);
|
||||
}
|
||||
|
||||
public function testPopoverStateToArray(): void
|
||||
{
|
||||
$state = new PopoverState(
|
||||
isVisible: true,
|
||||
position: 'top',
|
||||
anchorId: 'test-anchor'
|
||||
);
|
||||
|
||||
$array = $state->toArray();
|
||||
|
||||
$this->assertTrue($array['is_visible']);
|
||||
$this->assertEquals('top', $array['position']);
|
||||
$this->assertEquals('test-anchor', $array['anchor_id']);
|
||||
}
|
||||
|
||||
public function testPopoverStateIsAutoPosition(): void
|
||||
{
|
||||
$autoState = new PopoverState(position: 'auto');
|
||||
$topState = new PopoverState(position: 'top');
|
||||
|
||||
$this->assertTrue($autoState->isAutoPosition());
|
||||
$this->assertFalse($topState->isAutoPosition());
|
||||
}
|
||||
|
||||
public function testPopoverStateGetPositionClass(): void
|
||||
{
|
||||
$state = new PopoverState(position: 'top');
|
||||
$this->assertEquals('popover--top', $state->getPositionClass());
|
||||
|
||||
$state = new PopoverState(position: 'bottom');
|
||||
$this->assertEquals('popover--bottom', $state->getPositionClass());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user