1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace CarlosIO\Geckoboard\Tests\Widgets; |
4
|
|
|
|
5
|
|
|
use CarlosIO\Geckoboard\Data\Bullet\Item; |
6
|
|
|
use CarlosIO\Geckoboard\Widgets\Bullet; |
7
|
|
|
|
8
|
|
|
class BulletTest extends \PHPUnit_Framework_TestCase |
9
|
|
|
{ |
10
|
|
|
public function testOrientation() |
11
|
|
|
{ |
12
|
|
|
$myBullet = new Bullet(); |
13
|
|
|
|
14
|
|
|
$this->assertEquals('horizontal', $myBullet->getOrientation()); |
15
|
|
|
|
16
|
|
|
$myBullet->setOrientation('vertical'); |
17
|
|
|
|
18
|
|
|
$this->assertEquals('vertical', $myBullet->getOrientation()); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
public function testGetDataWithItem() |
22
|
|
|
{ |
23
|
|
|
$myBullet = new Bullet(); |
24
|
|
|
|
25
|
|
|
$item = new Item(); |
26
|
|
|
$item->setAxisPoint('x'); |
27
|
|
|
$item->setComparative('comparative'); |
28
|
|
|
$item->setLabel('label'); |
29
|
|
|
$item->setMeasure('measure'); |
30
|
|
|
$item->setRange('range'); |
31
|
|
|
$item->setSublabel('sublabel'); |
32
|
|
|
|
33
|
|
|
$myBullet->setItem($item); |
34
|
|
|
|
35
|
|
|
$expectedData = array( |
36
|
|
|
'orientation' => 'horizontal', |
37
|
|
|
'item' => array( |
38
|
|
|
'label' => $item->getLabel(), |
39
|
|
|
'sublabel' => $item->getSublabel(), |
40
|
|
|
'axis' => array('point' => $item->getAxisPoint()), |
41
|
|
|
'range' => $item->getRange(), |
42
|
|
|
'measure' => $item->getMeasure(), |
43
|
|
|
'comparative' => array('point' => $item->getComparative()), |
44
|
|
|
), |
45
|
|
|
); |
46
|
|
|
|
47
|
|
|
$this->assertEquals($expectedData, $myBullet->getData()); |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|