testWhenStatusIsWrongShouldReturnAnException()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace CarlosIO\Geckoboard\Tests\Widgets;
4
5
use CarlosIO\Geckoboard\Widgets\Monitoring;
6
7
/**
8
 * Class MonitoringTest.
9
 */
10
class MonitoringTest extends \PHPUnit_Framework_TestCase
11
{
12
    /**
13
     * @var \CarlosIO\Geckoboard\Widgets\Monitoring
14
     */
15
    private $myMonitoringWidget;
16
17
    protected function setUp()
18
    {
19
        $this->myMonitoringWidget = new Monitoring();
20
    }
21
22
    public function testJsonForFullData()
23
    {
24
        $this->myMonitoringWidget
25
            ->setStatus('Up')
26
            ->setDownTime('9 days ago')
27
            ->setResponseTime('593 ms');
28
29
        $json = json_encode($this->myMonitoringWidget->getData());
30
        $this->assertEquals('{"status":"Up","downTime":"9 days ago","responseTime":"593 ms"}', $json);
31
    }
32
33
    public function testWhenStatusIsWrongShouldReturnAnException()
34
    {
35
        $this->setExpectedException('\InvalidArgumentException');
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
36
37
        $this->myMonitoringWidget
38
            ->setStatus('^^-^^');
39
    }
40
41
    protected function tearDown()
42
    {
43
        unset($this->myMonitoringWidget);
44
    }
45
}
46