pathinfo = $_SERVER['PATH_INFO'];
$_SERVER['PATH_INFO'] = '/welcome/index';
// set Request::$main
$request = \Request::forge('welcome/index');
$rp = new \ReflectionProperty($request, 'main');
$rp->setAccessible(true);
$rp->setValue($request, $request);
\Request::active($request);
}
public function tearDown()
{
// remove the fake uri
if (property_exists($this, 'pathinfo'))
{
$_SERVER['PATH_INFO'] = $this->pathinfo;
}
else
{
unset($_SERVER['PATH_INFO']);
}
// reset Request::$main
$request = \Request::forge();
$rp = new \ReflectionProperty($request, 'main');
$rp->setAccessible(true);
$rp->setValue($request, false);
}
/**
* Test of "for" attribute in label tag
*/
public function test_for_in_label()
{
$form = Fieldset::forge(__METHOD__)->set_config(array(
// regular form definitions
'prep_value' => true,
'auto_id' => true,
'auto_id_prefix' => 'form_',
'form_method' => 'post',
'form_template' => "\n\t\t{open}\n\t\t
\n\t\t{close}\n",
'fieldset_template' => "\n\t\t{open} |
\n\t\t{close}\n",
'field_template' => "\t\t\n\t\t\t{label}{required} | \n\t\t\t{field} {description} {error_msg} | \n\t\t
\n",
'multi_field_template' => "\t\t\n\t\t\t{group_label}{required} | \n\t\t\t{fields}\n\t\t\t\t{field} {label} \n{fields}{description}\t\t\t{error_msg}\n\t\t\t | \n\t\t
\n",
'error_template' => '{error_msg}',
'group_label' => '{label}',
'required_mark' => '*',
'inline_errors' => false,
'error_class' => 'validation_error',
// tabular form definitions
'tabular_form_template' => "\n",
'tabular_field_template' => "{field}",
'tabular_row_template' => "{fields}
\n",
'tabular_row_field_template' => "\t\t\t{label}{required} {field} {icon} {error_msg} | \n",
'tabular_delete_label' => "Delete?",
));
$ops = array('male', 'female');
$form->add('gender', '', array(
'options' => $ops, 'type' => 'radio', 'value' => 1,
));
$output = $form->build();
$output = str_replace(array("\n", "\t"), "", $output);
$expected = '';
$this->assertEquals($expected, $output);
}
}