public function testGetTree() { $resources = ['resource1', 'resource2', 'resource3']; $mappedResources = ['mapped1', 'mapped2', 'mapped3']; $this->aclResourceProviderMock->expects($this->once())->method('getAclResources')->willReturn($resources); $this->integrationDataMock->expects($this->once())->method('mapResources')->willReturn($mappedResources); $this->assertEquals($mappedResources, $this->model->getTree()); }
/** * @param bool $isAllowed * @dataProvider dataProviderBoolValues */ public function testIsEverythingAllowed($isAllowed) { $id = 10; $this->coreRegistryMock->expects($this->once())->method('registry')->with(\Magento\User\Controller\Adminhtml\User\Role\SaveRole::RESOURCE_ALL_FORM_DATA_SESSION_KEY)->willReturn(true); if ($isAllowed) { $this->rootResourceMock->expects($this->exactly(2))->method('getId')->willReturnOnConsecutiveCalls($id, $id); } else { $this->rootResourceMock->expects($this->exactly(2))->method('getId')->willReturnOnConsecutiveCalls(11, $id); } $this->assertEquals($isAllowed, $this->model->isEverythingAllowed()); }
public function testGetTree() { $encodedTree = $this->_block->getTree(); $this->assertNotEmpty($encodedTree); }