/** * Update Save and Delete buttons. Remove Delete button if group can't be deleted. * * @return void */ protected function _construct() { parent::_construct(); $this->_objectId = 'id'; $this->_controller = 'adminhtml_group'; $this->_blockGroup = 'Magento_Customer'; $this->buttonList->update('save', 'label', __('Save Customer Group')); $this->buttonList->update('delete', 'label', __('Delete Customer Group')); $groupId = $this->coreRegistry->registry(RegistryConstants::CURRENT_GROUP_ID); if (!$groupId || $this->groupManagement->isReadonly($groupId)) { $this->buttonList->remove('delete'); } }
/** * @expectedException \Magento\Framework\Exception\NoSuchEntityException */ public function testIsReadonlyWithInvalidGroupId() { $testGroup = ['id' => 4, 'code' => 'General', 'tax_class_id' => 3, 'tax_class_name' => 'Retail Customer']; $this->groupManagement->isReadonly($testGroup['id']); }