| @@ 23-31 (lines=9) @@ | ||
| 20 | /** |
|
| 21 | * Test with an incomplete dataset. |
|
| 22 | */ |
|
| 23 | public function testJsonForSomeData() |
|
| 24 | { |
|
| 25 | $widget = new Text(); |
|
| 26 | $firstItem = new Item(); |
|
| 27 | $firstItem->setText('first text'); |
|
| 28 | $widget->addItem($firstItem); |
|
| 29 | $json = json_encode($widget->getData()); |
|
| 30 | $this->assertEquals('{"item":[{"text":"first text","type":0}]}', $json); |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * Test with one full dataset. |
|
| @@ 36-45 (lines=10) @@ | ||
| 33 | /** |
|
| 34 | * Test with one full dataset. |
|
| 35 | */ |
|
| 36 | public function testJsonForFullData() |
|
| 37 | { |
|
| 38 | $widget = new Text(); |
|
| 39 | $firstItem = new Item(); |
|
| 40 | $firstItem->setText('first text'); |
|
| 41 | $firstItem->setType(Item::TYPE_INFO); |
|
| 42 | $widget->addItem($firstItem); |
|
| 43 | $json = json_encode($widget->getData()); |
|
| 44 | $this->assertEquals('{"item":[{"text":"first text","type":2}]}', $json); |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * Test with more than one dataset. |
|