-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make rules, features, and feature sets more easily serializable
- Loading branch information
Christian Thomas
committed
Nov 8, 2017
1 parent
30fd73e
commit a9959f5
Showing
8 changed files
with
120 additions
and
5 deletions.
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
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,33 @@ | ||
<?php | ||
namespace RemotelyLiving\Doorkeeper\Tests\Rules; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use RemotelyLiving\Doorkeeper\Rules\Random; | ||
use RemotelyLiving\Doorkeeper\Rules\RuleAbstract; | ||
use RemotelyLiving\Doorkeeper\Tests\Utility\RuleAbstractMock; | ||
|
||
class AbstractTest extends TestCase | ||
{ | ||
/** | ||
* @var RuleAbstract | ||
*/ | ||
private $rule_abstract; | ||
|
||
protected function setUp() | ||
{ | ||
$this->rule_abstract = new RuleAbstractMock(); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function jsonSerializes() | ||
{ | ||
$this->rule_abstract->addPrerequisite(new Random()); | ||
//@codingStandardsIgnoreStart | ||
$expected = '{"type":"RemotelyLiving\\\Doorkeeper\\\Tests\\\Utility\\\RuleAbstractMock","value":"mockValue","prerequisites":[{"type":"RemotelyLiving\\\Doorkeeper\\\Rules\\\Random","value":null,"prerequisites":[]}]}'; | ||
//@codingStandardsIgnoreStop | ||
|
||
$this->assertEquals($expected, json_encode($this->rule_abstract)); | ||
} | ||
} |
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,25 @@ | ||
<?php | ||
namespace RemotelyLiving\Doorkeeper\Tests\Utility; | ||
|
||
use RemotelyLiving\Doorkeeper\Requestor; | ||
use RemotelyLiving\Doorkeeper\Rules\RuleAbstract; | ||
|
||
class RuleAbstractMock extends RuleAbstract | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getValue() | ||
{ | ||
return 'mockValue'; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function childCanBeSatisfied(Requestor $requestor = null): bool | ||
{ | ||
$requestor; | ||
return true; | ||
} | ||
} |