Beispiel #1
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 \Magento\Framework\Object(['test1' => '3', 'test2' => '2'])));
     $this->assertEquals(new \Magento\Framework\Object(['test1' => '3', 'test2' => '2']), $this->_block->getTotals());
 }
Beispiel #2
0
 /**
  * Preparing layout
  *
  * @return \Magento\ConfigurableProduct\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 \Magento\Catalog\Model\Entity\Attribute */
         /** @var $block \Magento\Backend\Block\Widget\Grid\Column */
         $block = $this->addChild($attribute->getAttributeCode(), 'Magento\\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;
 }
 public function testBeforeToHtmlAddsClassToLastColumn()
 {
     $this->_columnMock->expects($this->any())->method('addHeaderCssClass')->with($this->equalTo('last'));
     $this->_block->toHtml();
 }
Beispiel #4
0
 public function testGetMainButtonsHtmlReturnsEmptyStringIfFiltersArentVisible()
 {
     $this->_columnSetMock->expects($this->once())->method('isFilterVisible')->will($this->returnValue(false));
     $this->_block->getMainButtonsHtml();
 }