public function testGetMethodsNoChild() { $layout = new Mage_Core_Model_Layout(); $block = $layout->createBlock('Mage_Checkout_Block_Cart'); $methods = $block->getMethods('child'); $this->assertEquals(array(), $methods); }
public function testGetMassactionBlock() { $layout = new Mage_Core_Model_Layout(); $block = $layout->createBlock('Mage_Adminhtml_Block_Widget_Grid', 'block'); $child = $layout->addBlock('Mage_Core_Block_Template', 'massaction', 'block'); $this->assertSame($child, $block->getMassactionBlock()); }
/** * @magentoAppIsolation enabled */ public function testGetGridJsObject() { Mage::register('current_product', new Varien_Object()); $layout = new Mage_Core_Model_Layout(); $block = $layout->createBlock('Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Config', 'block'); $this->assertEquals('super_product_linksJsObject', $block->getGridJsObject()); }
public function testGetAdditionalActionBlock() { $layout = new Mage_Core_Model_Layout(); $block = $layout->createBlock('Mage_Adminhtml_Block_Widget_Grid_Massaction_Item', 'block'); $expected = $layout->addBlock('Mage_Core_Block_Template', 'additional_action', 'block'); $this->assertSame($expected, $block->getAdditionalActionBlock()); }
/** * @param Mage_Core_Model_Layout */ protected function showAddressFields(Mage_Core_Model_Layout $layout) { $registerForm = $layout->getBlock('customer_form_register'); if ($registerForm instanceof Mage_Core_Block_Abstract) { $registerForm->setShowAddressFields(true); } }
protected function setUp() { $this->_layoutMock = Mage::getModel('Mage_Core_Model_Layout'); $this->_block = $this->_layoutMock->createBlock('Mage_Backend_Block_Widget_Grid_Extended', 'grid', array('layout' => $this->_layoutMock)); $this->_block->addColumn('column1', array('id' => 'columnId1')); $this->_block->addColumn('column2', array('id' => 'columnId2')); }
public function testSetListCollection() { $childBlock = $this->_layout->addBlock('Mage_Core_Block_Text', 'search_result_list', 'block'); $this->assertEmpty($childBlock->getCollection()); $this->_block->setListCollection(); $this->assertInstanceOf('Mage_CatalogSearch_Model_Resource_Advanced_Collection', $childBlock->getCollection()); }
protected function setUp() { $this->_objectManager = Mage::getObjectManager(); $this->_layout = $this->_objectManager->get('Mage_Core_Model_Layout'); $this->_blockFactory = $this->_objectManager->get('Mage_Core_Model_BlockFactory'); $this->_block = $this->_blockFactory->createBlock('Mage_Webapi_Block_Adminhtml_User_Edit_Tab_Main'); $this->_layout->addBlock($this->_block); }
protected function setUp() { $customer = new Mage_Customer_Model_Customer(); $customer->load(1); Mage::register('current_customer', $customer); $layout = new Mage_Core_Model_Layout(array('area' => 'adminhtml')); $this->_block = $layout->createBlock('Mage_Adminhtml_Block_Customer_Edit_Tab_View_Accordion'); }
/** * Get form instance * * @param array $args * @return Varien_Data_Form */ protected function _getFormInstance($args = array()) { $layout = new Mage_Core_Model_Layout(); /** @var $block Mage_Adminhtml_Block_Urlrewrite_Cms_Page_Edit_Form */ $block = $layout->createBlock('Mage_Adminhtml_Block_Urlrewrite_Cms_Page_Edit_Form', 'block', $args); $block->toHtml(); return $block->getForm(); }
/** * @param $registryData * @param $expected * @dataProvider getStoreDataForBlock */ public function testGetHeaderText($registryData, $expected) { $this->_initStoreTypesInRegistry($registryData); $layout = new Mage_Core_Model_Layout(); $block = $layout->createBlock('Mage_Adminhtml_Block_System_Store_Edit', 'block'); $block->setArea(Mage_Core_Model_App_Area::AREA_ADMINHTML); $this->assertEquals($expected, $block->getHeaderText()); }
public function testToHtmlFormId() { $layout = new Mage_Core_Model_Layout(); $block = $layout->createBlock('Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Type_Select', 'select'); $html = $block->getPriceTypeSelectHtml(); $this->assertContains('select_{{select_id}}', $html); $this->assertContains('[{{select_id}}]', $html); }
protected function setUp() { $this->_objectManager = Mage::getObjectManager(); $this->_urlBuilder = $this->getMockBuilder('Mage_Backend_Model_Url')->disableOriginalConstructor()->getMock(); $this->_layout = $this->_objectManager->get('Mage_Core_Model_Layout'); $this->_blockFactory = $this->_objectManager->get('Mage_Core_Model_BlockFactory'); $this->_block = $this->_blockFactory->createBlock($this->_formClass, array('urlBuilder' => $this->_urlBuilder)); $this->_layout->addBlock($this->_block); }
public function testGetColumns() { $layout = new Mage_Core_Model_Layout(); $block = $layout->addBlock('Mage_Wishlist_Block_Customer_Wishlist_Items', 'test'); $child = $this->getMock('Mage_Core_Block_Text', array('isEnabled')); $child->expects($this->any())->method('isEnabled')->will($this->returnValue(true)); $layout->addBlock($child, 'child', 'test'); $this->assertSame(array($child), $block->getColumns()); }
public function testSetListOrders() { $layout = new Mage_Core_Model_Layout(); $layout->addBlock('Mage_Core_Block_Text', 'head'); // The tested block is using head block $block = $layout->addBlock('Mage_CatalogSearch_Block_Result', 'block'); $childBlock = $layout->addBlock('Mage_Core_Block_Text', 'search_result_list', 'block'); $this->assertSame($childBlock, $block->getListBlock()); }
public function testGetMode() { $layout = new Mage_Core_Model_Layout(); $layout->addBlock($this->_block, 'test'); $expected = uniqid(); $toolbar = new Mage_Core_Block_Text(array('current_mode' => $expected)); $layout->addBlock($toolbar, 'toolbar', 'test'); $this->assertEquals($expected, $this->_block->getMode()); }
/** * Test prepare layout * * @dataProvider prepareLayoutDataProvider * * @param array $blockAttributes * @param array $expected */ public function testPrepareLayout($blockAttributes, $expected) { $layout = new Mage_Core_Model_Layout(array('area' => Mage_Core_Model_App_Area::AREA_ADMINHTML)); /** @var $block Mage_Adminhtml_Block_Urlrewrite_Edit */ $block = $layout->createBlock('Mage_Adminhtml_Block_Urlrewrite_Edit', '', $blockAttributes); $this->_checkSelector($block, $expected); $this->_checkButtons($block, $expected); $this->_checkForm($block, $expected); }
/** * Reuse code for testing getUploadButtonHtml() * * @param Mage_Core_Block_Abstract $block */ public static function performUploadButtonTest(Mage_Core_Block_Abstract $block) { $layout = new Mage_Core_Model_Layout(); $layout->addBlock($block, 'links'); $expected = uniqid(); $text = new Mage_Core_Block_Text(array('text' => $expected)); $layout->addBlock($text, 'upload_button', 'links'); self::assertEquals($expected, $block->getUploadButtonHtml()); }
protected function setUp() { $this->_layout = Mage::getModel('Mage_Core_Model_Layout'); $this->_layout->addBlock('Mage_Core_Block_Text', 'root'); $this->_layout->addBlock('Mage_Core_Block_Text', 'head'); $this->_block = $this->_layout->createBlock('Mage_Tag_Block_Product_Result', 'test', array('layout' => $this->_layout)); $this->_child = Mage::getObjectManager()->create('Mage_Core_Block_Text'); $this->_layout->addBlock($this->_child, 'search_result_list', 'test'); }
protected function setUp() { $this->_block = new Mage_Tag_Block_Product_Result(); $this->_layout = new Mage_Core_Model_Layout(); $this->_layout->addBlock('Mage_Core_Block_Text', 'root'); $this->_layout->addBlock('Mage_Core_Block_Text', 'head'); $this->_layout->addBlock($this->_block, 'test'); $this->_child = new Mage_Core_Block_Text(); $this->_layout->addBlock($this->_child, 'search_result_list', 'test'); }
/** * Composes a container with several buttons in it * * @param array $titles * @return Mage_Adminhtml_Block_Widget_Container */ protected function _buildBlock($titles) { $layout = new Mage_Core_Model_Layout(); $block = new Mage_Adminhtml_Block_Widget_Container(); foreach ($titles as $id => $title) { $block->addButton($id, array('title' => $title)); } $layout->addBlock($block, 'block'); return $block; }
/** * @magentoAppIsolation enabled */ public function testAddTab() { $widgetInstance = new Mage_Widget_Model_Widget_Instance(); Mage::register('current_widget_instance', $widgetInstance); $layout = new Mage_Core_Model_Layout(); $block = $layout->createBlock('Mage_Adminhtml_Block_Widget_Tabs', 'block'); $layout->addBlock('Mage_Widget_Block_Adminhtml_Widget_Instance_Edit_Tab_Main', 'child_tab', 'block'); $block->addTab('tab_id', 'child_tab'); $this->assertEquals(array('tab_id'), $block->getTabsIds()); }
protected function setUp() { $this->_authorizationConfig = $this->getMockBuilder('Mage_Webapi_Model_Authorization_Config')->disableOriginalConstructor()->setMethods(array('getAclResourcesAsArray'))->getMock(); $this->_ruleResource = $this->getMockBuilder('Mage_Webapi_Model_Resource_Acl_Rule')->disableOriginalConstructor()->setMethods(array('getResourceIdsByRole'))->getMock(); $this->_objectManager = Mage::getObjectManager(); $this->_layout = $this->_objectManager->get('Mage_Core_Model_Layout'); $this->_blockFactory = $this->_objectManager->get('Mage_Core_Model_BlockFactory'); $this->_block = $this->_blockFactory->createBlock('Mage_Webapi_Block_Adminhtml_Role_Edit_Tab_Resource', array('authorizationConfig' => $this->_authorizationConfig, 'ruleResource' => $this->_ruleResource)); $this->_layout->addBlock($this->_block); }
public function testGetPagerHtml() { $layout = new Mage_Core_Model_Layout(); $block = $layout->createBlock('Mage_Catalog_Block_Product_List_Toolbar', 'block'); $childBlock = $layout->addBlock('Mage_Core_Block_Text', 'product_list_toolbar_pager', 'block'); $expectedHtml = '<b>Any text there</b>'; $this->assertNotEquals($expectedHtml, $block->getPagerHtml()); $childBlock->setText($expectedHtml); $this->assertEquals($expectedHtml, $block->getPagerHtml()); }
public function testGetShowQueueAdd() { $layout = new Mage_Core_Model_Layout(); $block = $layout->createBlock('Mage_Adminhtml_Block_Newsletter_Subscriber', 'block'); $childBlock = $layout->addBlock('Mage_Core_Block_Template', 'grid', 'block'); $expected = 'test_data'; $this->assertNotEquals($expected, $block->getShowQueueAdd()); $childBlock->setShowQueueAdd($expected); $this->assertEquals($expected, $block->getShowQueueAdd()); }
/** * @magentoAppIsolation enabled */ public function testToHtmlHasIndex() { Mage::getDesign()->setArea(Mage_Core_Model_App_Area::AREA_ADMINHTML); $layout = new Mage_Core_Model_Layout(array('area' => Mage_Core_Model_App_Area::AREA_ADMINHTML)); $block = $layout->createBlock('Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Search', 'block'); $indexValue = 'magento_index_set_to_test'; $block->setIndex($indexValue); $html = $block->toHtml(); $this->assertContains($indexValue, $html); }
public function testSetClassType() { $layout = new Mage_Core_Model_Layout(); $block = $layout->createBlock('Mage_Adminhtml_Block_Tax_Class', 'block'); $childBlock = $layout->addBlock('Mage_Core_Block_Template', 'grid', 'block'); $expected = Mage_Tax_Model_Class::TAX_CLASS_TYPE_PRODUCT; $this->assertNotEquals($expected, $childBlock->getClassType()); $block->setClassType($expected); $this->assertEquals($expected, $childBlock->getClassType()); }
public function testSetClassType() { $layout = new Mage_Core_Model_Layout(); $block = $layout->createBlock('Mage_Adminhtml_Block_Tax_Class_Edit', 'block'); $childBlock = $layout->addBlock('Mage_Core_Block_Template', 'form', 'block'); $expected = 'a_class_type'; $this->assertNotEquals($expected, $childBlock->getClassType()); $block->setClassType($expected); $this->assertEquals($expected, $childBlock->getClassType()); }
public function testDependenceHtml() { $layout = new Mage_Core_Model_Layout(); $block = $layout->createBlock('Mage_Adminhtml_Block_System_Config_Form', 'block'); $block->setArea('adminhtml'); $childBlock = $layout->addBlock('Mage_Core_Block_Text', 'element_dependence', 'block'); $expectedValue = 'dependence_html_relations'; $this->assertNotContains($expectedValue, $block->toHtml()); $childBlock->setText($expectedValue); $this->assertContains($expectedValue, $block->toHtml()); }
public function testSetLayout() { $layout = new Mage_Core_Model_Layout(); $headBlock = new Mage_Core_Block_Template(); $layout->addBlock($headBlock, 'head'); $this->_block->setLayout($layout); $this->assertNotEmpty($headBlock->getTitle()); $this->assertEquals($this->_product->getMetaTitle(), $headBlock->getTitle()); $this->assertEquals($this->_product->getMetaKeyword(), $headBlock->getKeywords()); $this->assertEquals($this->_product->getMetaDescription(), $headBlock->getDescription()); }