PieChartTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 3
dl 0
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testJsonForFullData() 0 20 1
1
<?php
2
3
namespace CarlosIO\Geckoboard\Tests\Widgets;
4
5
use CarlosIO\Geckoboard\Data\PieChart\Entry;
6
use CarlosIO\Geckoboard\Widgets\PieChart;
7
8
class PieChartTest extends \PHPUnit_Framework_TestCase
9
{
10
    public function testJsonForFullData()
11
    {
12
        $myWidget = new PieChart();
13
        $myWidget->setId('29473-d7ae87e3-ac3f-4911-95ce-ec91439a4170');
14
15
        $entry = new Entry();
16
        $entry->setLabel('Portion 1')->setValue(87809)->setColor('ffffff');
17
        $myWidget->addEntry($entry);
18
19
        $entry = new Entry();
20
        $entry->setLabel('Portion 2')->setValue(70022)->setColor('dddddd');
21
        $myWidget->addEntry($entry);
22
23
        $entry = new Entry();
24
        $entry->setLabel('Portion 3')->setValue(63232)->setColor('eaeaea');
25
        $myWidget->addEntry($entry);
26
27
        $json = json_encode($myWidget->getData());
28
        $this->assertEquals('{"item":[{"value":"87809","label":"Portion 1","color":"ffffff"},{"value":"70022","label":"Portion 2","color":"dddddd"},{"value":"63232","label":"Portion 3","color":"eaeaea"}]}', $json);
29
    }
30
}
31