Files
state-machine/tests/StateMachineTraitTest.php

27 lines
691 B
PHP
Raw Permalink Normal View History

2026-01-07 01:24:40 +01:00
<?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);
}
}