-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#111. Add more coverage on Json/StateMachine/Migrations
- Loading branch information
1 parent
ad85d33
commit e286f45
Showing
10 changed files
with
272 additions
and
194 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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,66 @@ | ||
<?php | ||
|
||
namespace rjapitest\unit\extensions; | ||
|
||
use rjapi\exceptions\AttributesException; | ||
use rjapi\extension\StateMachine; | ||
use rjapitest\unit\TestCase; | ||
|
||
/** | ||
* Class StateMachineTest | ||
* @package rjapitest\unit\extensions | ||
* | ||
* @property StateMachine stateMachine | ||
*/ | ||
class StateMachineTest extends TestCase | ||
{ | ||
private $stateMachine; | ||
|
||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
$this->stateMachine = new StateMachine('article'); | ||
try { | ||
$this->stateMachine->setStates('status'); | ||
} catch (AttributesException $e) { | ||
} | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_is_stated() | ||
{ | ||
$this->assertTrue($this->stateMachine->isStatedField('status')); | ||
} | ||
|
||
/** | ||
* @test | ||
* @expectedException \rjapi\exceptions\AttributesException | ||
*/ | ||
public function it_is_transitive() | ||
{ | ||
$this->assertTrue($this->stateMachine->isTransitive('draft', 'published')); | ||
$this->stateMachine->setStates('foo'); | ||
} | ||
|
||
/** | ||
* @test | ||
* @expectedException \rjapi\exceptions\AttributesException | ||
*/ | ||
public function it_sets_initial_and_gets_field() | ||
{ | ||
$this->stateMachine->setInitial('status'); | ||
$this->assertEquals($this->stateMachine->getInitial(), 'draft'); | ||
$this->assertTrue($this->stateMachine->isInitial('draft')); | ||
$this->stateMachine->setInitial('foo'); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_gets_field() | ||
{ | ||
$this->assertEquals('status', $this->stateMachine->getField()); | ||
} | ||
} |
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