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:
127
tests/Unit/Framework/LiveComponents/Security/TestComponents.php
Normal file
127
tests/Unit/Framework/LiveComponents/Security/TestComponents.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Framework\LiveComponents\Security;
|
||||
|
||||
use App\Application\LiveComponents\Counter\CounterState;
|
||||
use App\Framework\LiveComponents\Attributes\Action;
|
||||
use App\Framework\LiveComponents\Contracts\LiveComponentContract;
|
||||
use App\Framework\LiveComponents\ValueObjects\ComponentId;
|
||||
use App\Framework\LiveComponents\ValueObjects\ComponentRenderData;
|
||||
|
||||
/**
|
||||
* Test Component with valid action
|
||||
*/
|
||||
final class ValidActionComponent implements LiveComponentContract
|
||||
{
|
||||
public function __construct(
|
||||
public ComponentId $id,
|
||||
public CounterState $state
|
||||
) {
|
||||
}
|
||||
|
||||
public function getRenderData(): ComponentRenderData
|
||||
{
|
||||
return new ComponentRenderData(templatePath: 'test', data: []);
|
||||
}
|
||||
|
||||
#[Action]
|
||||
public function validAction(): CounterState
|
||||
{
|
||||
return $this->state;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Component with private action (should fail validation)
|
||||
*/
|
||||
final class PrivateActionComponent implements LiveComponentContract
|
||||
{
|
||||
public function __construct(
|
||||
public ComponentId $id,
|
||||
public CounterState $state
|
||||
) {
|
||||
}
|
||||
|
||||
public function getRenderData(): ComponentRenderData
|
||||
{
|
||||
return new ComponentRenderData(templatePath: 'test', data: []);
|
||||
}
|
||||
|
||||
#[Action]
|
||||
private function privateAction(): CounterState
|
||||
{
|
||||
return $this->state;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Component with static action (should fail validation)
|
||||
*/
|
||||
final class StaticActionComponent implements LiveComponentContract
|
||||
{
|
||||
public function __construct(
|
||||
public ComponentId $id,
|
||||
public CounterState $state
|
||||
) {
|
||||
}
|
||||
|
||||
public function getRenderData(): ComponentRenderData
|
||||
{
|
||||
return new ComponentRenderData(templatePath: 'test', data: []);
|
||||
}
|
||||
|
||||
#[Action]
|
||||
public static function staticAction(): CounterState
|
||||
{
|
||||
return CounterState::empty();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Component with primitive return type (should fail validation)
|
||||
*/
|
||||
final class PrimitiveReturnTypeComponent implements LiveComponentContract
|
||||
{
|
||||
public function __construct(
|
||||
public ComponentId $id,
|
||||
public CounterState $state
|
||||
) {
|
||||
}
|
||||
|
||||
public function getRenderData(): ComponentRenderData
|
||||
{
|
||||
return new ComponentRenderData(templatePath: 'test', data: []);
|
||||
}
|
||||
|
||||
#[Action]
|
||||
public function intAction(): int
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Component with array return type (should fail validation)
|
||||
*/
|
||||
final class ArrayReturnTypeComponent implements LiveComponentContract
|
||||
{
|
||||
public function __construct(
|
||||
public ComponentId $id,
|
||||
public CounterState $state
|
||||
) {
|
||||
}
|
||||
|
||||
public function getRenderData(): ComponentRenderData
|
||||
{
|
||||
return new ComponentRenderData(templatePath: 'test', data: []);
|
||||
}
|
||||
|
||||
#[Action]
|
||||
public function arrayAction(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user