helper('form');
}
// ------------------------------------------------------------------------
public function test_form_hidden()
{
$expected = <<
EOH;
$this->assertEquals($expected, form_hidden('username', 'johndoe'));
}
// ------------------------------------------------------------------------
public function test_form_input()
{
$expected = <<
EOH;
$data = array(
'name' => 'username',
'id' => 'username',
'value' => 'johndoe',
'maxlength' => '100',
'size' => '50',
'style' => 'width:50%',
);
$this->assertEquals($expected, form_input($data));
}
// ------------------------------------------------------------------------
public function test_form_password()
{
$expected = <<
EOH;
$this->assertEquals($expected, form_password('password'));
}
// ------------------------------------------------------------------------
public function test_form_upload()
{
$expected = <<
EOH;
$this->assertEquals($expected, form_upload('attachment'));
}
// ------------------------------------------------------------------------
public function test_form_textarea()
{
$expected = <<Notes
EOH;
$this->assertEquals($expected, form_textarea('notes', 'Notes'));
}
// ------------------------------------------------------------------------
public function test_form_dropdown()
{
$expected = <<
EOH;
$options = array(
'small' => 'Small Shirt',
'med' => 'Medium Shirt',
'large' => 'Large Shirt',
'xlarge' => 'Extra Large Shirt',
);
$this->assertEquals($expected, form_dropdown('shirts', $options, 'large'));
$expected = <<
EOH;
$shirts_on_sale = array('small', 'large');
$this->assertEquals($expected, form_dropdown('shirts', $options, $shirts_on_sale));
$options = array(
'Swedish Cars' => array(
'volvo' => 'Volvo',
'saab' => 'Saab'
),
'German Cars' => array(
'mercedes' => 'Mercedes',
'audi' => 'Audi'
)
);
$expected = <<
EOH;
$this->assertEquals($expected, form_dropdown('cars', $options, array('volvo', 'audi')));
}
// ------------------------------------------------------------------------
public function test_form_multiselect()
{
$expected = <<
EOH;
$options = array(
'small' => 'Small Shirt',
'med' => 'Medium Shirt',
'large' => 'Large Shirt',
'xlarge' => 'Extra Large Shirt',
);
$this->assertEquals($expected, form_multiselect('shirts[]', $options, array('med', 'large')));
}
// ------------------------------------------------------------------------
public function test_form_fieldset()
{
$expected = <<
EOH;
$this->assertEquals($expected, form_fieldset('Address Information'));
}
// ------------------------------------------------------------------------
public function test_form_fieldset_close()
{
$expected = <<
EOH;
$this->assertEquals($expected, form_fieldset_close(''));
}
// ------------------------------------------------------------------------
public function test_form_checkbox()
{
$expected = <<
EOH;
$this->assertEquals($expected, form_checkbox('newsletter', 'accept', TRUE));
}
// ------------------------------------------------------------------------
public function test_form_radio()
{
$expected = <<
EOH;
$this->assertEquals($expected, form_radio('newsletter', 'accept', TRUE));
}
// ------------------------------------------------------------------------
public function test_form_submit()
{
$expected = <<
EOH;
$this->assertEquals($expected, form_submit('mysubmit', 'Submit Post!'));
}
// ------------------------------------------------------------------------
public function test_form_label()
{
$expected = <<What is your Name
EOH;
$this->assertEquals($expected, form_label('What is your Name', 'username'));
}
// ------------------------------------------------------------------------
public function test_form_reset()
{
$expected = <<
EOH;
$this->assertEquals($expected, form_reset('myreset', 'Reset'));
}
// ------------------------------------------------------------------------
public function test_form_button()
{
$expected = <<content
EOH;
$this->assertEquals($expected, form_button('name', 'content'));
}
// ------------------------------------------------------------------------
public function test_form_close()
{
$expected = <<
EOH;
$this->assertEquals($expected, form_close(''));
}
}
/* End of file form_helper_test.php */