示例#1
0
 /**
  * @covers Xoops\Form\SelectTimeZone::__construct
  * @covers Xoops\Form\SelectTimeZone::render
  */
 public function test__construct()
 {
     $value = new \DateTimeZone('Europe/Paris');
     $oldWay = new SelectTimeZone('mycaption', 'myname', $value);
     $newWay = new SelectTimeZone(['caption' => 'mycaption', 'name' => 'myname', 'value' => $value]);
     $this->assertEquals($oldWay->render(), $newWay->render());
 }
 /**
  * @covers Xoops\Form\SelectTimeZone::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="-12"'));
     $this->assertTrue(false !== strpos($value, 'value="0"'));
     $this->assertTrue(false !== strpos($value, 'value="12"'));
     $this->assertTrue(false !== strpos($value, '</option>'));
 }