public function testGetVarValue() { $this->assertFalse($this->_model->getVarValue('Unknown', 'nonexisting')); $this->assertEquals('Value One', $this->_model->getVarValue('Two', 'one')); $this->assertEquals('Value Two', $this->_model->getVarValue('Two', 'two')); $this->assertEquals('Value Three', $this->_model->getVarValue('Three', 'three')); }
/** * Load data item values and default values from the view configuration * * @param array &$control * @param string $paramName * @param \Magento\Framework\Config\View $viewConfiguration * @return $this */ protected function _loadControlData(array &$control, $paramName, \Magento\Framework\Config\View $viewConfiguration) { if (!empty($control['var'])) { list($module, $varKey) = $this->_extractModuleKey($control['var']); $control[$paramName] = $viewConfiguration->getVarValue($module, $varKey); } return $this; }