Beispiel #1
0
 /**
  * @covers Xoops\Form\Select::addOptionArray
  */
 public function testAddOptionArray()
 {
     $this->object->addOptionArray(array('opt_key' => 'opt_name', 'opt_just_key' => null));
     $value = $this->object->getOptions();
     $this->assertTrue(is_array($value));
     $this->assertSame('opt_name', $value['opt_key']);
     $this->assertSame('opt_just_key', $value['opt_just_key']);
 }
Beispiel #2
0
 public function testAddOptionAndSetOptionsAndGetOptions()
 {
     $value = 'testValue';
     $label = 'testLabel';
     $params = ['paramKey' => 'paramValue'];
     $options = [['value' => $value, 'label' => $label, 'params' => $params]];
     $this->assertEquals([], $this->select->getOptions());
     $this->select->addOption($value, $label, $params);
     $this->assertEquals($options, $this->select->getOptions());
     $options[0]['value'] = 'newValue';
     $this->select->setOptions($options);
     $this->assertEquals($options, $this->select->getOptions());
 }
 public function testVerificaSeInsereOpcao()
 {
     $select = new Select();
     $select->addOption(array("value" => "1", "name" => "categoria1"));
     $this->assertEquals(array(array("value" => "1", "name" => "categoria1")), $select->getOptions());
 }