summaryrefslogtreecommitdiff
path: root/tests/unit/Web/UI/WebControls/TDropDownListTest.php
blob: 503466fec144fd563f879f79b02e6884a919f808 (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
<?php


Prado::using('System.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++;
    }
  }
}

?>