|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace CarlosIO\Geckoboard\Tests\Widgets; |
|
4
|
|
|
|
|
5
|
|
|
use CarlosIO\Geckoboard\Data\Funnel\Entry; |
|
6
|
|
|
use CarlosIO\Geckoboard\Widgets\Funnel; |
|
7
|
|
|
|
|
8
|
|
|
class FunnelTest extends \PHPUnit_Framework_TestCase |
|
9
|
|
|
{ |
|
10
|
|
|
public function testJsonForFullData() |
|
11
|
|
|
{ |
|
12
|
|
|
$myWidget = new Funnel(); |
|
13
|
|
|
$myWidget->setId('29473-d7ae87e3-ac3f-4911-95ce-ec91439a4170'); |
|
14
|
|
|
$myWidget->setType('reversed'); |
|
15
|
|
|
$myWidget->setShowPercentage(false); |
|
16
|
|
|
|
|
17
|
|
|
$error = new Entry(); |
|
18
|
|
|
$error->setLabel('Step 1')->setValue(87809); |
|
19
|
|
|
$myWidget->addEntry($error); |
|
20
|
|
|
|
|
21
|
|
|
$error = new Entry(); |
|
22
|
|
|
$error->setLabel('Step 2')->setValue(70022); |
|
23
|
|
|
$myWidget->addEntry($error); |
|
24
|
|
|
|
|
25
|
|
|
$error = new Entry(); |
|
26
|
|
|
$error->setLabel('Step 3')->setValue(63232); |
|
27
|
|
|
$myWidget->addEntry($error); |
|
28
|
|
|
|
|
29
|
|
|
$error = new Entry(); |
|
30
|
|
|
$error->setLabel('Step 4')->setValue(53232); |
|
31
|
|
|
$myWidget->addEntry($error); |
|
32
|
|
|
|
|
33
|
|
|
$error = new Entry(); |
|
34
|
|
|
$error->setLabel('Step 5')->setValue(32123); |
|
35
|
|
|
$myWidget->addEntry($error); |
|
36
|
|
|
|
|
37
|
|
|
$error = new Entry(); |
|
38
|
|
|
$error->setLabel('Step 6')->setValue(23232); |
|
39
|
|
|
$myWidget->addEntry($error); |
|
40
|
|
|
|
|
41
|
|
|
$error = new Entry(); |
|
42
|
|
|
$error->setLabel('Step 7')->setValue(12232); |
|
43
|
|
|
$myWidget->addEntry($error); |
|
44
|
|
|
|
|
45
|
|
|
$error = new Entry(); |
|
46
|
|
|
$error->setLabel('Step 8')->setValue(2323); |
|
47
|
|
|
$myWidget->addEntry($error); |
|
48
|
|
|
|
|
49
|
|
|
$json = json_encode($myWidget->getData()); |
|
50
|
|
|
$this->assertEquals('{"type":"reverse","percentage":"hide","item":[{"value":"87809","label":"Step 1"},{"value":"70022","label":"Step 2"},{"value":"63232","label":"Step 3"},{"value":"53232","label":"Step 4"},{"value":"32123","label":"Step 5"},{"value":"23232","label":"Step 6"},{"value":"12232","label":"Step 7"},{"value":"2323","label":"Step 8"}]}', $json); |
|
51
|
|
|
} |
|
52
|
|
|
} |
|
53
|
|
|
|