From 92392ccd62aad24bfcd51e4653477139bdd403bc Mon Sep 17 00:00:00 2001 From: Alex Paliarush Date: Wed, 10 Aug 2016 11:08:16 -0500 Subject: [PATCH] MAGETWO-52555: [Github][PR] Don't hardcode the Magento_Backend::admin index #4396 --- .../Block/Adminhtml/Integration/Edit/Tab/WebapiTest.php | 7 ++++--- .../Magento/User/Test/Unit/Block/Role/Tab/EditTest.php | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Integration/Test/Unit/Block/Adminhtml/Integration/Edit/Tab/WebapiTest.php b/app/code/Magento/Integration/Test/Unit/Block/Adminhtml/Integration/Edit/Tab/WebapiTest.php index 0c6d9b7fc7aca..d4c60966ab29b 100644 --- a/app/code/Magento/Integration/Test/Unit/Block/Adminhtml/Integration/Edit/Tab/WebapiTest.php +++ b/app/code/Magento/Integration/Test/Unit/Block/Adminhtml/Integration/Edit/Tab/WebapiTest.php @@ -155,7 +155,8 @@ 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') @@ -163,7 +164,7 @@ public function testGetTree() $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()); } @@ -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' => [ diff --git a/app/code/Magento/User/Test/Unit/Block/Role/Tab/EditTest.php b/app/code/Magento/User/Test/Unit/Block/Role/Tab/EditTest.php index 271e0973e13da..666bb2bc832a3 100644 --- a/app/code/Magento/User/Test/Unit/Block/Role/Tab/EditTest.php +++ b/app/code/Magento/User/Test/Unit/Block/Role/Tab/EditTest.php @@ -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);