Example #1
0
 protected function setUp()
 {
     $this->_layoutMock = $this->getMock('Mage_Core_Model_Layout', array(), array(), '', false);
     $this->_columnSetMock = $this->getMock('Mage_Backend_Block_Widget_Grid_ColumnSet');
     $returnValueMap = array(array('grid', 'grid.columnSet', 'grid.columnSet'), array('grid', 'reset_filter_button', 'reset_filter_button'), array('grid', 'search_button', 'search_button'));
     $this->_layoutMock->expects($this->any())->method('getChildName')->will($this->returnValueMap($returnValueMap));
     $this->_layoutMock->expects($this->any())->method('getBlock')->with('grid.columnSet')->will($this->returnValue($this->_columnSetMock));
     $this->_layoutMock->expects($this->any())->method('createBlock')->with('Mage_Backend_Block_Widget_Button')->will($this->returnValue(new Mage_Backend_Block_Widget_Button()));
     $this->_block = new Mage_Backend_Block_Widget_Grid(array('layout' => $this->_layoutMock));
     $this->_block->setNameInLayout('grid');
 }
Example #2
0
 protected function setUp()
 {
     $this->_columnMock = $this->getMock('Mage_Backend_Block_Widget_Grid_Column', array('setSortable', 'setRendererType', 'setFilterType'), array(), '', false);
     $this->_layoutMock = $this->getMock('Mage_Core_Model_Layout', array(), array(), '', false);
     $this->_layoutMock->expects($this->any())->method('getChildBlocks')->will($this->returnValue(array('column' => $this->_columnMock)));
     $this->_helperMock = $this->getMock('Mage_Backend_Helper_Data', array(), array(), '', false);
     $this->_helperMock->expects($this->any())->method('__')->will($this->returnValue('TRANSLATED STRING'));
     $this->_factoryMock = $this->getMock('Mage_Backend_Model_Widget_Grid_Row_UrlGeneratorFactory', array(), array(), '', false);
     $this->_subtotalsMock = $this->getMock('Mage_Backend_Model_Widget_Grid_SubTotals', array(), array(), '', false);
     $this->_totalsMock = $this->getMock('Mage_Backend_Model_Widget_Grid_Totals', array(), array(), '', false);
     $arguments = array('layout' => $this->_layoutMock, 'helper' => $this->_helperMock, 'generatorFactory' => $this->_factoryMock, 'totals' => $this->_totalsMock, 'subtotals' => $this->_subtotalsMock);
     $objectManagerHelper = new Magento_Test_Helper_ObjectManager($this);
     $this->_block = $objectManagerHelper->getBlock('Mage_Backend_Block_Widget_Grid_ColumnSet', $arguments);
     $this->_block->setNameInLayout('grid.columnSet');
 }