Source for file FormOptionsHelperTest.php
Documentation is available at FormOptionsHelperTest.php
* File for the FormOptionsHelperTest class
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @copyright (c) Walter O. Haas 2006
* @version $Id: FormOptionsHelperTest.php 198 2006-04-20 16:20:30Z haas $
* @author Walt Haas <haas@xmission.com>
echo "testing FormOptionsHelper\n";
require_once 'testenv.php';
// Call FormOptionsHelperTest::main() if this source file is executed directly.
if (!defined("PHPUnit2_MAIN_METHOD")) {
define("PHPUnit2_MAIN_METHOD", "FormOptionsHelperTest::main");
require_once "PHPUnit2/Framework/TestCase.php";
require_once "PHPUnit2/Framework/TestSuite.php";
// You may remove the following line when all tests have been implemented.
require_once "PHPUnit2/Framework/IncompleteTestError.php";
require_once "action_view/helpers.php";
require_once "action_view/helpers/form_helper.php";
require_once "action_view/helpers/form_options_helper.php";
* Test class for FormOptionsHelper.
* Generated by PHPUnit2_Util_Skeleton on 2006-03-01 at 13:17:32.
* Runs the test methods of this class.
public static function main() {
require_once "PHPUnit2/TextUI/TestRunner.php";
$suite = new PHPUnit2_Framework_TestSuite("FormOptionsHelperTest");
$result = PHPUnit2_TextUI_TestRunner::run($suite);
* Sets up the fixture, for example, open a network connection.
* This method is called before a test is executed.
protected function setUp() {
* Tears down the fixture, for example, close a network connection.
* This method is called after a test is executed.
* @todo Write test for add_options()
// Remove the following line when you implement this test.
throw new PHPUnit2_Framework_IncompleteTestError;
* @todo Write test for country_options_for_select()
// Spot check a few countries
$countries = $fo->country_options_for_select();
$this->assertContains('Bangladesh', $countries);
$this->assertContains('Canada', $countries);
$this->assertContains('Ecuador', $countries);
$this->assertContains('France', $countries);
$countries = $fo->country_options_for_select(17);
$this->assertContains('value="17" selected="selected"', $countries);
// Remove the following line when you implement this test.
throw new PHPUnit2_Framework_IncompleteTestError;
* Test the options_for_select() method
// Test choices with none selected
$this->assertEquals('<option value="0">foo</option>' . "\n"
. '<option value="1">bar</option>',
$fo->options_for_select(array('foo','bar')));
// Test choices with one selected
$this->assertEquals('<option value="0">mumble</option>' . "\n"
. '<option value="1" selected="selected">grumble</option>',
$fo->options_for_select(array('mumble','grumble'),1));
* @todo Write test for options_from_collection_for_select()
// Remove the following line when you implement this test.
throw new PHPUnit2_Framework_IncompleteTestError;
* @todo Write test for to_collection_select_tag()
// Remove the following line when you implement this test.
throw new PHPUnit2_Framework_IncompleteTestError;
* @todo Write test for to_country_select_tag()
// Remove the following line when you implement this test.
throw new PHPUnit2_Framework_IncompleteTestError;
* @todo Write test for to_select_tag()
// Remove the following line when you implement this test.
throw new PHPUnit2_Framework_IncompleteTestError;
* @todo Write test for collection_select()
// Remove the following line when you implement this test.
throw new PHPUnit2_Framework_IncompleteTestError;
* @todo Write test for country_select()
// Remove the following line when you implement this test.
throw new PHPUnit2_Framework_IncompleteTestError;
* Test options_for_select() function
// Test choices with none selected
$this->assertEquals('<option value="0">foo</option>' . "\n"
. '<option value="1">bar</option>',
// Test choices with one selected by key
$this->assertEquals('<option value="M">mumble</option>' . "\n"
. '<option value="G" selected="selected">grumble</option>',
* @todo Write test for select()
// Remove the following line when you implement this test.
throw new PHPUnit2_Framework_IncompleteTestError;
// Call FormOptionsHelperTest::main() if this source file is executed directly.
// -- set Emacs parameters --
// c-hanging-comment-ender-p: nil
|