diff options
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/Web/UI/WebControls/TDropDownListTest.php | 30 | ||||
-rw-r--r-- | tests/unit/Web/UI/WebControls/TRequiredFieldValidatorTest.php | 17 |
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/unit/Web/UI/WebControls/TDropDownListTest.php b/tests/unit/Web/UI/WebControls/TDropDownListTest.php new file mode 100644 index 00000000..b93d32cf --- /dev/null +++ b/tests/unit/Web/UI/WebControls/TDropDownListTest.php @@ -0,0 +1,30 @@ +<?php +require_once dirname(__FILE__).'/../../../phpunit2.php'; + +Prado::using('System.Web.UI.WebControls.TDropDownList'); + +/** + * @package System.Web.UI.WebControls + */ +class TDropDownListTest extends PHPUnit2_Framework_TestCase { + + public function testSetDataSource() { + $list = new TDropDownList(); + $data = array('a' => 1, + 'b' => 2, + 'c' => 3); + $list->setDataSource($data); + $list->dataBind(); + $items =& $list->getItems(); + $this->assertTrue($items instanceof TListItemCollection); + $expected_keys = array_keys($data); + $i = 0; + foreach($items as $item) { + $this->assertEquals($expected_keys[$i], $item->getValue()); + $this->assertEquals((string)$data[$expected_keys[$i]], $item->getText()); + $i++; + } + } +} + +?>
\ No newline at end of file diff --git a/tests/unit/Web/UI/WebControls/TRequiredFieldValidatorTest.php b/tests/unit/Web/UI/WebControls/TRequiredFieldValidatorTest.php new file mode 100644 index 00000000..3146cb06 --- /dev/null +++ b/tests/unit/Web/UI/WebControls/TRequiredFieldValidatorTest.php @@ -0,0 +1,17 @@ +<?php +require_once dirname(__FILE__).'/../../../phpunit2.php'; + +Prado::using('System.Web.UI.WebControls.TRequiredFieldValidator'); + +/** + * @package System.Web.UI.WebControls + */ +class TRequiredFieldValidatorTest extends PHPUnit2_Framework_TestCase { + + public function testGetEmptyInitialValue() { + $validator = new TRequiredFieldValidator(); + $this->assertEquals('', $validator->getInitialValue()); + } +} + +?>
\ No newline at end of file |