-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #238 from fmeccanici/feature/allow-all-state-trans…
…itions Feature/Method to allow all state transitions
- Loading branch information
Showing
13 changed files
with
173 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
tests/Dummy/AllowAllTransitionsState/AllowAllTransitionsState.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Spatie\ModelStates\Tests\Dummy\AllowAllTransitionsState; | ||
|
||
use Spatie\ModelStates\State; | ||
use Spatie\ModelStates\StateConfig; | ||
|
||
abstract class AllowAllTransitionsState extends State | ||
{ | ||
public static function config(): StateConfig | ||
{ | ||
return parent::config() | ||
->default(StateA::class) | ||
->registerState(StateA::class) | ||
->registerState(StateB::class) | ||
->registerState(StateC::class) | ||
->allowAllTransitions(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace Spatie\ModelStates\Tests\Dummy\AllowAllTransitionsState; | ||
|
||
class StateA extends AllowAllTransitionsState | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Spatie\ModelStates\Tests\Dummy\AllowAllTransitionsState; | ||
|
||
use Spatie\ModelStates\Tests\Dummy\AllowAllTransitionsState\AllowAllTransitionsState; | ||
|
||
class StateB extends AllowAllTransitionsState | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Spatie\ModelStates\Tests\Dummy\AllowAllTransitionsState; | ||
|
||
use Spatie\ModelStates\Tests\Dummy\AllowAllTransitionsState\AllowAllTransitionsState; | ||
|
||
class StateC extends AllowAllTransitionsState | ||
{ | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
...TransitionsStateWithNoRegisteredStates/AllowAllTransitionsStateWithNoRegisteredStates.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Spatie\ModelStates\Tests\Dummy\AllowAllTransitionsStateWithNoRegisteredStates; | ||
|
||
use Spatie\ModelStates\State; | ||
use Spatie\ModelStates\StateConfig; | ||
|
||
abstract class AllowAllTransitionsStateWithNoRegisteredStates extends State | ||
{ | ||
public static function config(): StateConfig | ||
{ | ||
return parent::config() | ||
->default(StateAWithNoRegisteredStates::class) | ||
->allowAllTransitions(); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
tests/Dummy/AllowAllTransitionsStateWithNoRegisteredStates/StateAWithNoRegisteredStates.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace Spatie\ModelStates\Tests\Dummy\AllowAllTransitionsStateWithNoRegisteredStates; | ||
|
||
class StateAWithNoRegisteredStates extends AllowAllTransitionsStateWithNoRegisteredStates | ||
{ | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
tests/Dummy/AllowAllTransitionsStateWithNoRegisteredStates/StateBWithNoRegisteredStates.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace Spatie\ModelStates\Tests\Dummy\AllowAllTransitionsStateWithNoRegisteredStates; | ||
|
||
class StateBWithNoRegisteredStates extends AllowAllTransitionsStateWithNoRegisteredStates | ||
{ | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
tests/Dummy/AllowAllTransitionsStateWithNoRegisteredStates/StateCWithNoRegisteredStates.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace Spatie\ModelStates\Tests\Dummy\AllowAllTransitionsStateWithNoRegisteredStates; | ||
|
||
class StateCWithNoRegisteredStates extends AllowAllTransitionsStateWithNoRegisteredStates | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace Spatie\ModelStates\Tests\Dummy; | ||
|
||
use Spatie\ModelStates\Tests\Dummy\AllowAllTransitionsState\AllowAllTransitionsState; | ||
|
||
class TestModelAllowAllTransitions extends TestModel | ||
{ | ||
protected $casts = [ | ||
'state' => AllowAllTransitionsState::class, | ||
]; | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/Dummy/TestModelAllowAllTransitionsWithNoRegisteredStates.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace Spatie\ModelStates\Tests\Dummy; | ||
|
||
use Spatie\ModelStates\Tests\Dummy\AllowAllTransitionsStateWithNoRegisteredStates\AllowAllTransitionsStateWithNoRegisteredStates; | ||
|
||
class TestModelAllowAllTransitionsWithNoRegisteredStates extends TestModel | ||
{ | ||
protected $casts = [ | ||
'state' => AllowAllTransitionsStateWithNoRegisteredStates::class, | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters