Skip to content

Commit

Permalink
MAGETWO-52555: [Github][PR] Don't hardcode the Magento_Backend::admin…
Browse files Browse the repository at this point in the history
… index #4396
  • Loading branch information
Alex Paliarush authored and Oleksii Korshenko committed Aug 12, 2016
1 parent 6b51259 commit 92392cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,16 @@ public function testGetTree()
{
$this->webapiBlock = $this->getWebapiBlock();
$resources = [
1 => [ 'children' => [1, 2, 3] ]
['id' => 'Magento_Backend::admin', 'children' => ['resource1', 'resource2', 'resource3']],
['id' => 'Invalid_Node', 'children' => ['resource4', 'resource5', 'resource6']]
];
$this->aclResourceProvider->expects($this->once())
->method('getAclResources')
->will($this->returnValue($resources));
$rootArray = "rootArrayValue";
$this->integrationHelper->expects($this->once())
->method('mapResources')
->with([1, 2, 3])
->with(['resource1', 'resource2', 'resource3'])
->will($this->returnValue($rootArray));
$this->assertEquals($rootArray, $this->webapiBlock->getTree());
}
Expand Down Expand Up @@ -197,7 +198,7 @@ public function isEverythingAllowedWithSavedFromDataProvider()
return [
'root resource in array' => [
2,
['all_resources' => 0, 'resource'=>[2, 3]],
['all_resources' => 0, 'resource' => [2, 3]],
true
],
'root resource not in array' => [
Expand Down
5 changes: 4 additions & 1 deletion app/code/Magento/User/Test/Unit/Block/Role/Tab/EditTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ protected function setUp()

public function testGetTree()
{
$resources = ['resource1', 'resource2', 'resource3'];
$resources = [
['id' => 'Magento_Backend::admin', 'children' => ['resource1', 'resource2', 'resource3']],
['id' => 'Invalid_Node', 'children' => ['resource4', 'resource5', 'resource6']]
];
$mappedResources = ['mapped1', 'mapped2', 'mapped3'];
$this->aclResourceProviderMock->expects($this->once())->method('getAclResources')->willReturn($resources);
$this->integrationDataMock->expects($this->once())->method('mapResources')->willReturn($mappedResources);
Expand Down

0 comments on commit 92392cc

Please sign in to comment.