LevelTest::testScenario()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
namespace Wonnova\SDK\Test\Model;
3
4
use PHPUnit_Framework_TestCase as TestCase;
5
use Wonnova\SDK\Model\Badge;
6
use Wonnova\SDK\Model\Level;
7
use Wonnova\SDK\Model\Scenario;
8
9
/**
10
 * Class LevelTest
11
 * @author Wonnova
12
 * @link http://www.wonnova.com
13
 */
14
class LevelTest extends TestCase
15
{
16
    /**
17
     * @var Level
18
     */
19
    private $level;
20
21
    public function setUp()
22
    {
23
        $this->level = new Level();
24
    }
25
26
    public function testCode()
27
    {
28
        $expected = 'THE_LEVEL';
29
        $this->assertNull($this->level->getCode());
30
        $this->assertSame($this->level, $this->level->setCode($expected));
31
        $this->assertEquals($expected, $this->level->getCode());
32
    }
33
34
    public function testName()
35
    {
36
        $expected = 'The Level';
37
        $this->assertNull($this->level->getName());
38
        $this->assertSame($this->level, $this->level->setName($expected));
39
        $this->assertEquals($expected, $this->level->getName());
40
    }
41
42
    public function testScore()
43
    {
44
        $expected = 500;
45
        $this->assertNull($this->level->getScore());
46
        $this->assertSame($this->level, $this->level->setScore($expected));
47
        $this->assertEquals($expected, $this->level->getScore());
48
    }
49
50 View Code Duplication
    public function testGeneratesNotification()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
51
    {
52
        $expected = true;
53
        $this->assertNull($this->level->getGeneratesNotification());
54
        $this->assertSame($this->level, $this->level->setGeneratesNotification($expected));
55
        $this->assertEquals($expected, $this->level->getGeneratesNotification());
56
    }
57
58
    public function testCategoryEnabled()
59
    {
60
        $expected = false;
61
        $this->assertNull($this->level->isCategoryEnabled());
62
        $this->assertSame($this->level, $this->level->setCategoryEnabled($expected));
63
        $this->assertEquals($expected, $this->level->isCategoryEnabled());
64
    }
65
66
    public function testImageUrl()
67
    {
68
        $expected = 'https://secure.wonnova.com/image';
69
        $this->assertNull($this->level->getImageUrl());
70
        $this->assertSame($this->level, $this->level->setImageUrl($expected));
71
        $this->assertEquals($expected, $this->level->getImageUrl());
72
    }
73
74 View Code Duplication
    public function testDateCreated()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
75
    {
76
        $expected = new \DateTime();
77
        $this->assertNull($this->level->getDateCreated());
78
        $this->assertSame($this->level, $this->level->setDateCreated($expected));
79
        $this->assertSame($expected, $this->level->getDateCreated());
80
81
        $this->level->setDateCreated('2010-01-01 00:00:00');
82
        $this->assertInstanceOf('DateTime', $this->level->getDateCreated());
83
    }
84
85
    public function testBadge()
86
    {
87
        $expected = new Badge();
88
        $this->assertNull($this->level->getBadge());
89
        $this->assertSame($this->level, $this->level->setBadge($expected));
90
        $this->assertSame($expected, $this->level->getBadge());
91
    }
92
93
    public function testScenario()
94
    {
95
        $expected = new Scenario();
96
        $this->assertNull($this->level->getScenario());
97
        $this->assertSame($this->level, $this->level->setScenario($expected));
98
        $this->assertSame($expected, $this->level->getScenario());
99
    }
100
}
101