public function testThrowsExceptionIfTransitionStringDoesNotMatchPattern()
 {
     $transitionString = 'kaboom!';
     $this->expectException(TransitionPatternMismatch::class);
     $this->expectExceptionMessage(sprintf('The provided transition string "%s" does not match the configured pattern: "%s"', $transitionString, DefaultTransition::getPattern()));
     DefaultTransition::new($transitionString);
 }
 public function testThrowsExceptionWhenProvidingInvalidInputToState()
 {
     $this->expectException(InvalidInputForState::class);
     $this->expectExceptionMessage('Cannot CLOSE a CLOSED object');
     $transitionTable = new DefaultTransitionTable(DefaultTransition::new('CLOSED + OPEN = OPENED'));
     try {
         $transitionTable->resolve(FlyweightState::named('CLOSED'), FlyweightInput::named('CLOSE'));
     } catch (InvalidInputForState $exception) {
         $this->assertSame(FlyweightInput::named('CLOSE'), $exception->getInput());
         $this->assertSame(FlyweightState::named('CLOSED'), $exception->getState());
         throw $exception;
     }
 }
 public function __construct()
 {
     $this->wrappedTransitionTable = new DefaultTransitionTable(DefaultTransition::new('WHITES_TURN + WHITE_MOVES = BLACKS_TURN'), DefaultTransition::new('BLACKS_TURN + BLACK_MOVES = WHITES_TURN'), DefaultTransition::new('WHITES_TURN + CHECKMATE = WHITE_WINS'), DefaultTransition::new('BLACKS_TURN + CHECKMATE = BLACK_WINS'), DefaultTransition::new('WHITES_TURN + STALEMATE = DRAW'), DefaultTransition::new('BLACKS_TURN + STALEMATE = DRAW'));
 }