blob: 3331aee68e461adb6b4dd5e55e01f2729dbfa144 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<?php
use Prado\Collections\TListItemCollection;
use Prado\Web\UI\WebControls\TDropDownList;
/**
* @package System.Web.UI.WebControls
*/
class TDropDownListTest extends PHPUnit_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++;
}
}
}
|