8 class AclTest extends \PHPUnit\Framework\TestCase
27 $this->_aclMock = $this->createMock(\
Magento\Framework\Acl::class);
28 $this->_aclBuilderMock = $this->createMock(\
Magento\Framework\
Acl\Builder::class);
29 $this->_aclBuilderMock->expects($this->any())->method(
'getAcl')->will($this->returnValue($this->_aclMock));
30 $this->_model = new \Magento\Framework\Authorization\Policy\Acl($this->_aclBuilderMock);
35 $this->_aclMock->expects(
43 $this->returnValue(
true)
46 $this->assertTrue($this->_model->isAllowed(
'some_role',
'some_resource'));
51 $this->_aclMock->expects(
62 $this->_aclMock->expects($this->once())->method(
'has')->with(
'some_resource')->will($this->returnValue(
true));
64 $this->assertFalse($this->_model->isAllowed(
'some_role',
'some_resource'));
69 $this->_aclMock->expects(
80 $this->_aclMock->expects($this->once())->method(
'has')->with(
'some_resource')->will($this->returnValue(
false));
82 $this->_aclMock->expects(
90 $this->returnValue(
true)
93 $this->assertTrue($this->_model->isAllowed(
'some_role',
'some_resource'));
testIsAllowedReturnsTrueIfResourceIsAllowedToRole()
testIsAllowedReturnsTrueIfResourceDoesntExistAndAllResourcesAreNotPermitted()
testIsAllowedReturnsFalseIfRoleDoesntExist()