BadgeTest   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testName() 0 7 1
A testDescription() 0 7 1
A testImageUrl() 0 7 1
A testType() 0 7 1
A testNotificationDate() 0 7 1
A testToArray() 0 4 1
1
<?php
2
namespace Wonnova\SDK\Test\Model;
3
4
use PHPUnit_Framework_TestCase as TestCase;
5
use Wonnova\SDK\Model\Badge;
6
7
class BadgeTest extends TestCase
8
{
9
    /**
10
     * @var Badge
11
     */
12
    private $badge;
13
14
    public function setUp()
15
    {
16
        $this->badge = new Badge();
17
    }
18
19
    public function testName()
20
    {
21
        $expected = 'The Badge';
22
        $this->assertNull($this->badge->getName());
23
        $this->assertSame($this->badge, $this->badge->setName($expected));
24
        $this->assertEquals($expected, $this->badge->getName());
25
    }
26
27
    public function testDescription()
28
    {
29
        $expected = 'This is a nice badge';
30
        $this->assertNull($this->badge->getDescription());
31
        $this->assertSame($this->badge, $this->badge->setDescription($expected));
32
        $this->assertEquals($expected, $this->badge->getDescription());
33
    }
34
35
    public function testImageUrl()
36
    {
37
        $expected = 'https://secure.wonnova.com/rest/badges/34/image';
38
        $this->assertNull($this->badge->getImageUrl());
39
        $this->assertSame($this->badge, $this->badge->setImageUrl($expected));
40
        $this->assertEquals($expected, $this->badge->getImageUrl());
41
    }
42
43
    public function testType()
44
    {
45
        $expected = Badge::TYPE_COMBO;
46
        $this->assertNull($this->badge->getType());
47
        $this->assertSame($this->badge, $this->badge->setType($expected));
48
        $this->assertEquals($expected, $this->badge->getType());
49
    }
50
51
    public function testNotificationDate()
52
    {
53
        $expected = new \DateTime('2010-01-05 10:00:00');
54
        $this->assertNull($this->badge->getNotificationDate());
55
        $this->assertSame($this->badge, $this->badge->setNotificationDate($expected));
56
        $this->assertSame($expected, $this->badge->getNotificationDate());
57
    }
58
59
    public function testToArray()
60
    {
61
        $this->assertCount(0, $this->badge->toArray());
62
    }
63
}
64