From 0d56725dd699041530e92026868193e87b81b837 Mon Sep 17 00:00:00 2001 From: knut <> Date: Mon, 6 Feb 2006 20:01:41 +0000 Subject: added some more tests --- .gitattributes | 2 ++ .../unit/Web/UI/WebControls/TDropDownListTest.php | 30 ++++++++++++++++++++++ .../UI/WebControls/TRequiredFieldValidatorTest.php | 17 ++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 tests/unit/Web/UI/WebControls/TDropDownListTest.php create mode 100644 tests/unit/Web/UI/WebControls/TRequiredFieldValidatorTest.php 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 @@ + 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 @@ +assertEquals('', $validator->getInitialValue()); + } +} + +?> \ No newline at end of file -- cgit v1.2.3