/** * @param array $rowData * @param string $expectedResult * @dataProvider renderDataProvider */ public function testRender(array $rowData, $expectedResult) { $selectedTreeArray = array(array('value' => 1, 'label' => 'One')); $selectedFlatArray = array(1 => 'One'); $this->_column->expects($this->once())->method('getValues')->will($this->returnValue($selectedTreeArray)); $this->_column->expects($this->once())->method('getIndex')->will($this->returnValue('label')); $this->_column->expects($this->once())->method('getHtmlName')->will($this->returnValue('test[]')); $this->_converter->expects($this->once())->method('toFlatArray')->with($selectedTreeArray)->will($this->returnValue($selectedFlatArray)); $this->assertEquals($expectedResult, $this->_object->render(new \Magento\Framework\Object($rowData))); }
/** * @covers Xoops\Form\Radio::render */ public function testRender() { $this->object->addOption('key', 'value'); $value = $this->object->render(); $this->assertTrue(is_string($value)); $this->assertTrue(false !== strpos($value, '<label class="radio')); $this->assertTrue(false !== strpos($value, '<input type="radio"')); }
} } } /** * Radiobutton getter Function * @see skip_radio() * @ignore */ function get_radio($name, $value, $label = FALSE, $args = array(), $return = 'html') {
public function testInput() { $radio = new Radio(['name' => "name", 'value' => '1']); $this->assertEquals($radio->render(), '<div><input value="1" name="name" type="radio" /></div>'); }
/** * @covers Xoops\Form\Radio::__construct * @covers Xoops\Form\Radio::render */ public function test__construct() { $oldWay = new Radio('mycaption', 'myname', 'myvalue'); $newWay = new Radio(['caption' => 'mycaption', 'type' => 'button', 'name' => 'myname']); $this->assertEquals($oldWay->render(), $newWay->render()); }