From 3b6a6aa6704457c90751b536c8a56dd5a349aa52 Mon Sep 17 00:00:00 2001 From: Jarek Tkaczyk Date: Sun, 29 Nov 2020 13:19:05 +0800 Subject: [PATCH] php8 --- .travis.yml | 4 ++-- composer.json | 2 +- tests/FsmTest.php | 20 +++++++++----------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 86ec024..92ceca2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: php php: - - 7.1 - - 7.2 + - 7.4 + - 8.0 install: - travis_retry composer require php-coveralls/php-coveralls:^2.0@stable diff --git a/composer.json b/composer.json index 67f9253..7173425 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "php": ">=7.1.0" }, "require-dev": { - "phpunit/phpunit" : "^7.0" + "phpunit/phpunit" : ">=9.1" }, "autoload": { "psr-4": { diff --git a/tests/FsmTest.php b/tests/FsmTest.php index e06b09f..4410d2b 100644 --- a/tests/FsmTest.php +++ b/tests/FsmTest.php @@ -2,14 +2,16 @@ namespace Sofa\Unit\StateMachine; -use Sofa\StateMachine\Fsm; use PHPUnit\Framework\TestCase; -use Sofa\StateMachine\Transition; +use Sofa\StateMachine\DuplicateActionException; +use Sofa\StateMachine\Fsm; +use Sofa\StateMachine\InvalidActionException; use Sofa\StateMachine\StateMachineInterface; +use Sofa\StateMachine\Transition; class FsmTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -51,24 +53,20 @@ public function it_allows_customizing_transitions_logic() $this->assertEquals('customized', $this->stateful_object->prop); } - /** - * @test - * @expectedException Sofa\StateMachine\DuplicateActionException - */ + /** @test */ public function it_rejects_invalid_transition_definitions() { + $this->expectException(DuplicateActionException::class); new Fsm(new StatefulDouble, [ Transition::make('off', 'start', 'idle'), Transition::make('off', 'start', 'moving'), ]); } - /** - * @test - * @expectedException Sofa\StateMachine\InvalidActionException - */ + /** @test */ public function it_rejects_invalid_action_for_processing() { + $this->expectException(InvalidActionException::class); $this->fsm->process('move'); } }