12 class GridTest extends \PHPUnit\Framework\TestCase
31 $this->_layoutMock = $this->createPartialMock(
32 \
Magento\Framework\View\Layout::class,
33 [
'getChildName',
'getBlock',
'createBlock',
'helper',
'renameElement',
'unsetChild',
'setChild']
38 [
'grid',
'grid.columnSet',
'grid.columnSet'],
39 [
'grid',
'reset_filter_button',
'reset_filter_button'],
40 [
'grid',
'search_button',
'search_button'],
42 $this->_layoutMock->expects(
47 $this->returnValueMap($returnValueMap)
49 $this->_layoutMock->expects(
56 $this->returnValue($this->_columnSetMock)
58 $this->_layoutMock->expects(
67 \
Magento\Framework\View\LayoutInterface::class
73 $this->_layoutMock->expects(
78 \
Magento\Framework\Json\Helper\Data::class
82 \
Magento\Framework\Json\Helper\Data::class
88 \
Magento\Framework\View\LayoutInterface::class
92 $this->_block->setLayout($this->_layoutMock);
93 $this->_block->setNameInLayout(
'grid');
108 return $this->getMockBuilder(\
Magento\Backend\Block\
Widget\
Grid\ColumnSet::class)
109 ->setConstructorArgs(
115 \
Magento\Framework\Filesystem::class,
116 [
'directoryList' => $directoryList]
130 $this->_columnSetMock->expects($this->once())->method(
'setRendererType');
131 $this->_columnSetMock->expects($this->once())->method(
'setFilterType');
132 $this->_columnSetMock->expects($this->once())->method(
'setSortable');
133 $this->_block->setColumnRenderers([
'filter' =>
'Filter_Class']);
134 $this->_block->setColumnFilters([
'filter' =>
'Filter_Class']);
135 $this->_block->setSortable(
false);
136 $this->_block->toHtml();
141 $this->_columnSetMock->expects($this->once())->method(
'isFilterVisible')->will($this->returnValue(
false));
142 $this->_block->getMainButtonsHtml();
145 public function testGetMassactionBlock()
149 \
Magento\Framework\View\LayoutInterface::class
153 $child = $layout->addBlock(\
Magento\Framework\View\Element\Template::class,
'massaction',
'block');
154 $this->assertSame($child,
$block->getMassactionBlock());
defined('TESTS_BP')||define('TESTS_BP' __DIR__
static getObjectManager()