public function testAdd_blank_option()
 {
     $options = 'noneArray';
     $expectedArray = array('' => '');
     $result = add_blank_option($options);
     $this->assertEquals($result[''], $expectedArray['']);
     $options2 = array('mason' => 'unittest');
     $expectedArray2 = array('' => '', 'mason' => 'unittest');
     $result2 = add_blank_option($options2);
     $this->assertEquals($result2, $expectedArray2);
 }
 function get_xtpl_search()
 {
     $searchFor = '';
     if (!empty($_REQUEST[$this->name])) {
         $searchFor = $_REQUEST[$this->name];
     }
     global $app_list_strings;
     $returnXTPL = array();
     $returnXTPL[strtoupper($this->name)] = $searchFor;
     $returnXTPL[strtoupper('options_' . $this->name)] = get_select_options_with_id(add_blank_option($app_list_strings[$this->ext1]), $searchFor);
     return $returnXTPL;
 }
 public function testadd_blank_option()
 {
     //execute the method with array not having any blank key value pair. function will return an array with blank key value pair added.
     $tempArray = array('Key1' => 'value1', 'Key2' => 'value2');
     $expected = array('' => '', 'Key1' => 'value1', 'Key2' => 'value2');
     $actual = add_blank_option($tempArray);
     $this->assertSame($actual, $expected);
     //execute the method with array having a blank key value pair. function will return the same array back without any change.
     $tempArray = array('' => '', 'Key1' => 'value1', 'Key2' => 'value2');
     $expected = array('' => '', 'Key1' => 'value1', 'Key2' => 'value2');
     $actual = add_blank_option($tempArray);
     $this->assertSame($actual, $expected);
 }
 function generateRadioButtons($value = '', $add_blank = false)
 {
     global $app_list_strings;
     $radiooptions = '';
     $keyvalues = $app_list_strings[$this->ext1];
     if ($add_blank) {
         $keyvalues = add_blank_option($keyvalues);
     }
     $help = !empty($this->help) ? "title='" . translate($this->help, $this->bean->module_dir) . "'" : '';
     foreach ($keyvalues as $key => $displayText) {
         $selected = $value == $key ? 'checked' : '';
         $radiooptions .= "<input type='radio' id='{$this->name}{$key}' name='{$this->name}'  {$help} value='{$key}' {$selected}><span onclick='document.getElementById(\"{$this->name}{$key}\").checked = true' style='cursor:default' onmousedown='return false;'>{$displayText}</span><br>\n";
     }
     return $radiooptions;
 }