diff options
author | knut <> | 2006-02-06 20:01:41 +0000 |
---|---|---|
committer | knut <> | 2006-02-06 20:01:41 +0000 |
commit | 0d56725dd699041530e92026868193e87b81b837 (patch) | |
tree | a6419479a7397341ec3c0a701b906bcf006e7cce | |
parent | 57f7e6924dc8e996a06b46418e8f98f4d0a9531b (diff) |
added some more tests
-rw-r--r-- | .gitattributes | 2 | ||||
-rw-r--r-- | tests/unit/Web/UI/WebControls/TDropDownListTest.php | 30 | ||||
-rw-r--r-- | tests/unit/Web/UI/WebControls/TRequiredFieldValidatorTest.php | 17 |
3 files changed, 49 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes index 799488e9..201b6440 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1034,5 +1034,7 @@ tests/unit/I18N/core/DateTimeFormatInfoTest.php -text tests/unit/I18N/core/NumberFormatInfoTest.php -text tests/unit/I18N/core/NumberFormatTest.php -text tests/unit/TComponentTest.php -text +tests/unit/Web/UI/WebControls/TDropDownListTest.php -text tests/unit/Web/UI/WebControls/TLabelTest.php -text +tests/unit/Web/UI/WebControls/TRequiredFieldValidatorTest.php -text tests/unit/phpunit2.php -text 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 |