/** * @param string $defaultValue * @param string $assert * @dataProvider renderProvider */ public function testRender($defaultValue, $assert) { $context = $this->getMockBuilder('\\Magento\\Backend\\Block\\Context')->disableOriginalConstructor()->getMock(); $model = new \Magento\Indexer\Block\Backend\Grid\Column\Renderer\Updated($context); $obj = new \Magento\Framework\DataObject(); $obj->setGetter('getValue'); $obj->setDefault($defaultValue); $obj->setValue(''); $model->setColumn($obj); $result = $model->render($obj); $this->assertEquals($result, $assert); }
/** * @param array $indexValues * @param string $expectedResult * @dataProvider renderDataProvider */ public function testRender($indexValues, $expectedResult) { $context = $this->getMockBuilder('\\Magento\\Backend\\Block\\Context')->disableOriginalConstructor()->getMock(); $model = new \Magento\Indexer\Block\Backend\Grid\Column\Renderer\Status($context); $obj = new \Magento\Framework\DataObject(); $obj->setGetter(null); $obj->setDefault(''); $obj->setValue(''); $obj->setIndex($indexValues[0]); $obj->setData($indexValues[0], $indexValues[0]); $model->setColumn($obj); $model->setIndex($indexValues[0]); $result = $model->render($obj); $this->assertEquals($result, '<span class="' . $expectedResult['class'] . '"><span>' . $expectedResult['text'] . '</span></span>'); }