/** * Test isEverythingAllowed method * * @dataProvider isEverythingAllowedDataProvider * @param array $selectedResources * @param bool $expectedResult */ public function testIsEverythingAllowed($selectedResources, $expectedResult) { $apiRole = new Varien_Object(array('role_id' => 1)); $apiRole->setIdFieldName('role_id'); $this->_block->setApiRole($apiRole); $this->_ruleResource->expects($this->once())->method('getResourceIdsByRole')->with($apiRole->getId())->will($this->returnValue($selectedResources)); $this->assertEquals($expectedResult, $this->_block->isEverythingAllowed()); }
/** * Test _prepareForm method * * @dataProvider prepareFormDataProvider * @param array $originResTree * @param array $selectedRes * @param array $expectedRes */ public function testPrepareForm($originResTree, $selectedRes, $expectedRes) { // TODO Move to unit tests after MAGETWO-4015 complete $apiRole = new Varien_Object(array('role_id' => 1)); $apiRole->setIdFieldName('role_id'); $this->_block->setApiRole($apiRole); $this->_authorizationConfig->expects($this->once())->method('getAclResourcesAsArray')->with(false)->will($this->returnValue($originResTree)); $this->_ruleResource->expects($this->once())->method('getResourceIdsByRole')->with($apiRole->getId())->will($this->returnValue($selectedRes)); $this->_block->toHtml(); $this->assertEquals($expectedRes, $this->_block->getResourcesTree()); }