forked from laminas/laminas-permissions-acl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds an assertion class to the test suite, and a unit test that exercises it to demonstrate the scenario presented in laminas#2. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
- Loading branch information
1 parent
3a81215
commit 0db3d53
Showing
2 changed files
with
51 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
/** | ||
* @see https://github.com/laminas/laminas-permissions-acl for the canonical source repository | ||
* @copyright https://github.com/laminas/laminas-permissions-acl/blob/master/COPYRIGHT.md | ||
* @license https://github.com/laminas/laminas-permissions-acl/blob/master/LICENSE.md New BSD License | ||
*/ | ||
|
||
namespace LaminasTest\Permissions\Acl\TestAsset; | ||
|
||
use Laminas\Permissions\Acl\Acl; | ||
use Laminas\Permissions\Acl\Assertion\AssertionInterface; | ||
use Laminas\Permissions\Acl\Resource\ResourceInterface; | ||
use Laminas\Permissions\Acl\Role\RoleInterface; | ||
|
||
/** | ||
* @see https://github.com/laminas/laminas-permissions-acl/issues/2 | ||
*/ | ||
class ChildBooleanAssertion implements AssertionInterface | ||
{ | ||
/** @var bool */ | ||
private $value; | ||
|
||
public function __construct($value) | ||
{ | ||
$this->value = (bool) $value; | ||
} | ||
|
||
public function assert(Acl $acl, RoleInterface $role = null, ResourceInterface $resource = null, $privilege = null) | ||
{ | ||
return $this->value; | ||
} | ||
} |