Esempio n. 1
0
 public function testGetRowUrl()
 {
     $itemMock = $this->getMock('Varien_Object', array(), array(), '', false);
     $rowUrlGenerator = $this->getMock('Mage_Backend_Model_Widget_Grid_Row_UrlGenerator', array(), array(), '', false);
     $rowUrlGenerator->expects($this->once())->method('getUrl')->with($this->equalTo($itemMock))->will($this->returnValue('http://localhost/mng/item/edit'));
     $model = new Mage_Backend_Block_Widget_Grid_ColumnSet(array('layout' => $this->_layoutMock, 'helper' => $this->_helperMock, 'rowUrl' => array('generator' => $rowUrlGenerator)));
     $url = $model->getRowUrl($itemMock);
     $this->assertEquals('http://localhost/mng/item/edit', $url);
 }
Esempio n. 2
0
 public function testToHtmlPreparesColumns()
 {
     $this->_columnSetMock->expects($this->once())->method('setRendererType');
     $this->_columnSetMock->expects($this->once())->method('setFilterType');
     $this->_columnSetMock->expects($this->once())->method('setSortable');
     $this->_block->setColumnRenderers(array('filter' => 'Filter_Class'));
     $this->_block->setColumnFilters(array('filter' => 'Filter_Class'));
     $this->_block->setSortable(false);
     $this->_block->toHtml();
 }
Esempio n. 3
0
 public function testGetTotals()
 {
     $collection = $this->_getTestCollection();
     $this->_prepareLayoutWithGrid($this->_prepareGridMock($collection));
     $this->_totalsMock->expects($this->once())->method('countTotals')->with($collection)->will($this->returnValue(new Varien_Object(array('test1' => '3', 'test2' => '2'))));
     $this->assertEquals(new Varien_Object(array('test1' => '3', 'test2' => '2')), $this->_block->getTotals());
 }
Esempio n. 4
0
 public function testBeforeToHtmlAddsClassToLastColumn()
 {
     $this->_columnMock->expects($this->any())->method('addHeaderCssClass')->with($this->equalTo('last'));
     $this->_block->toHtml();
 }
Esempio n. 5
0
 public function testGetMainButtonsHtmlReturnsEmptyStringIfFiltersArentVisible()
 {
     $this->_columnSetMock->expects($this->once())->method('isFilterVisible')->will($this->returnValue(false));
     $this->_block->getMainButtonsHtml();
 }
Esempio n. 6
0
 /**
  * Preparing layout
  *
  * @return Mage_Catalog_Block_Product_Configurable_AssociatedSelector_Backend_Grid_ColumnSet
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $product = $this->_getProduct();
     $attributes = $this->_productType->getUsedProductAttributes($product);
     foreach ($attributes as $attribute) {
         /** @var $attribute Mage_Catalog_Model_Entity_Attribute */
         /** @var $block Mage_Backend_Block_Widget_Grid_Column */
         $block = $this->addChild($attribute->getAttributeCode(), 'Mage_Backend_Block_Widget_Grid_Column', array('header' => $attribute->getStoreLabel(), 'index' => $attribute->getAttributeCode(), 'type' => 'options', 'options' => $this->getOptions($attribute->getSource()), 'sortable' => false));
         $block->setId($attribute->getAttributeCode())->setGrid($this);
     }
     return $this;
 }