public function testProcessWithArgumentUpdaters() { $arguments = array('one' => array('value' => 1, 'updater' => array('Dummy_Updater_1', 'Dummy_Updater_2'))); $this->_argumentUpdaterMock->expects($this->once())->method('applyUpdaters')->will($this->returnValue(1)); $expected = array('one' => 1); $this->assertEquals($expected, $this->_model->process($arguments)); }
public function testProcessWithArgumentUpdaters() { $arguments = array('one' => array('value' => 1, 'updater' => array('Dummy_Updater_1', 'Dummy_Updater_2'))); $argumentUpdaterMock = $this->getMock('Mage_Core_Model_Layout_Argument_Updater', array(), array(), '', false); $argumentUpdaterMock->expects($this->once())->method('applyUpdaters')->will($this->returnValue(1)); $this->_objectFactoryMock->expects($this->once())->method('getModelInstance')->with('Mage_Core_Model_Layout_Argument_Updater')->will($this->returnValue($argumentUpdaterMock)); $expected = array('one' => 1); $this->assertEquals($expected, $this->_model->process($arguments)); }
/** * Creates block object based on xml node data and add it to the layout * * @param string $elementName * @return Mage_Core_Block_Abstract * @throws Magento_Exception */ protected function _generateBlock($elementName) { list($type, $node, $actions, $arguments) = $this->_scheduledStructure->getElement($elementName); if ($type !== self::TYPE_BLOCK) { throw new Magento_Exception("Unexpected element type specified for generating block: {$type}."); } // create block if (!empty($node['class'])) { $className = (string) $node['class']; } else { $className = (string) $node['type']; } $arguments = $this->_argumentProcessor->process($arguments); $block = $this->_createBlock($className, $elementName, $arguments); if (!empty($node['template'])) { $block->setTemplate((string) $node['template']); } $this->_scheduledStructure->unsetElement($elementName); // execute block methods foreach ($actions as $action) { list($actionNode, $parent) = $action; $this->_generateAction($actionNode, $parent); } return $block; }