Initial commit

This commit is contained in:
Christopher Vagnetoft
2026-01-07 01:24:40 +01:00
commit 3d276060ec
14 changed files with 2258 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
<?php
namespace NoccyLabs\StateMachine;
use NoccyLabs\StateMachine\StateMachineTrait;
use NoccyLabs\StateMachine\StateTrait;
use NoccyLabs\StateMachine\Attributes\ValidTransitions;
require_once __DIR__."/OrderState.php";
#[\PHPUnit\Framework\Attributes\CoversClass(StateMachineTrait::class)]
class StateMachineTraitTest extends \PHPUnit\Framework\TestCase
{
use StateMachineTrait;
private OrderState $state = OrderState::PENDING;
public function testValidTransitions()
{
$this->tryTransition($this->state, OrderState::PROCESSING);
$this->expectException(\Exception::class);
$this->tryTransition($this->state, OrderState::SHIPPED);
}
}