/** * @expectedException InvalidArgumentException * @dataProvider setAttributeArgumentExceptionDataProvider * @param string $attribute */ public function testSetAttributeArgumentException($attribute) { $this->_structure->importElements(array('element' => array())); $this->_structure->setAttribute('element', $attribute, 'value'); }
/** * Set container-specific data to structure element * * @param string $name * @param string $label * @param array $options * @throws Magento_Exception if any of arguments are invalid */ protected function _generateContainer($name, $label, array $options) { if (empty($label)) { throw new Magento_Exception('Container requires a label.'); } $this->_structure->setAttribute($name, self::CONTAINER_OPT_LABEL, $label); unset($options[self::CONTAINER_OPT_LABEL]); unset($options['type']); if (empty($options[self::CONTAINER_OPT_HTML_TAG]) && (!empty($options[self::CONTAINER_OPT_HTML_ID]) || !empty($options[self::CONTAINER_OPT_HTML_CLASS]))) { throw new Magento_Exception('HTML ID or class will not have effect, if HTML tag is not specified.'); } foreach ($options as $key => $value) { $this->_structure->setAttribute($name, $key, $value); } }