Initial commit
This commit is contained in:
26
tests/StateMachineTraitTest.php
Normal file
26
tests/StateMachineTraitTest.php
Normal 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);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user