summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes2
-rw-r--r--tests/unit/Web/UI/WebControls/TDropDownListTest.php30
-rw-r--r--tests/unit/Web/UI/WebControls/TRequiredFieldValidatorTest.php17
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