/** * @return Mage_Widget_Model_Widget_Instance */ public function testGetWidgetSupportedContainers() { $this->_model->setType('Mage_Catalog_Block_Product_Widget_New'); $containers = $this->_model->getWidgetSupportedContainers(); $this->assertInternalType('array', $containers); $this->assertContains('left', $containers); $this->assertContains('content', $containers); $this->assertContains('right', $containers); return $this->_model; }
public function testSetGetType() { $model = new Mage_Widget_Model_Widget_Instance(); $this->assertEmpty($model->getType()); $model->setType('test-test'); $this->assertEquals('test/test', $model->getType()); $model->setData('instance_type', 'test-test'); $this->assertEquals('test/test', $model->getType()); }
/** * @return array */ public function widgetPlaceholderImagesDataProvider() { $result = array(); $model = new Mage_Widget_Model_Widget(); foreach ($model->getWidgetsArray() as $row) { $instance = new Mage_Widget_Model_Widget_Instance(); $config = $instance->setType($row['type'])->getWidgetConfig(); // @codingStandardsIgnoreStart if (isset($config->placeholder_image)) { $result[] = array((string) $config->placeholder_image); } // @codingStandardsIgnoreEnd } return $result; }
public function testComparedProductsWidget() { $model = new Mage_Widget_Model_Widget_Instance(); $config = $model->setType('Mage_Reports_Block_Product_Widget_Compared')->getWidgetConfig(); $templates = $config->xpath('parameters/template/values'); $templates = (array) $templates[0]->children(); $this->assertArrayHasKey('default', $templates); $this->assertArrayHasKey('list', $templates); $this->assertArrayHasKey('list_default', $templates); $this->assertArrayHasKey('list_names', $templates); $this->assertArrayHasKey('list_images', $templates); $blocks = $config->xpath('supported_containers'); $blocks = (array) $blocks[0]->children(); $this->assertArrayHasKey('left_column', $blocks); $this->assertArrayHasKey('main_content', $blocks); $this->assertArrayHasKey('right_column', $blocks); }
/** * Collect all declared widget blocks and templates * * @return array */ public function widgetTemplatesDataProvider() { $result = array(); $model = new Mage_Widget_Model_Widget(); foreach ($model->getWidgetsArray() as $row) { $instance = new Mage_Widget_Model_Widget_Instance(); $config = $instance->setType($row['type'])->getWidgetConfig(); $class = Mage::getConfig()->getBlockClassName($row['type']); if (is_subclass_of($class, 'Mage_Core_Block_Template')) { $templates = $config->xpath('/widgets/' . $row['code'] . '/parameters/template/values/*/value'); foreach ($templates as $template) { $result[] = array($class, (string) $template); } } } return $result; }