/** * @covers Xoops\Form\SelectGroup::render */ public function testRender() { $value = $this->object->render(); $this->assertTrue(is_string($value)); $this->assertTrue(false !== strpos($value, '<select')); $this->assertTrue(false !== strpos($value, 'name="name"')); $this->assertTrue(false !== strpos($value, 'size="1"')); $this->assertTrue(false !== strpos($value, 'title="Caption"')); $this->assertTrue(false !== strpos($value, 'id="name"')); $this->assertTrue(false !== strpos($value, '<option')); $this->assertTrue(false !== strpos($value, 'value="1"')); $this->assertTrue(false !== strpos($value, '</option>')); }
/** * @covers Xoops\Form\SelectGroup::__construct * @covers Xoops\Form\SelectGroup::render */ public function test__construct() { $oldWay = new SelectGroup('mycaption', 'myname', true, 2); $newWay = new SelectGroup(['caption' => 'mycaption', 'name' => 'myname', ':include_anon' => true, 'value' => 2]); $this->assertEquals($oldWay->render(), $newWay->render()); }
/** * Add optgroup element * * @param string $label The optgroup's label * @return \ValidFormBuilder\SelectGroup */ public function addGroup($label) { $objGroup = new SelectGroup($label); $objGroup->setMeta("parent", $this, true); $this->__options->addObject($objGroup); return $objGroup; }