1
|
|
|
<?php |
2
|
|
|
namespace Wonnova\SDK\Test\Model; |
3
|
|
|
|
4
|
|
|
use PHPUnit_Framework_TestCase as TestCase; |
5
|
|
|
use Wonnova\SDK\Model\Team; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class TeamTest |
9
|
|
|
* @author Wonnova |
10
|
|
|
* @link http://www.wonnova.com |
11
|
|
|
*/ |
12
|
|
|
class TeamTest extends TestCase |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* @var Team |
16
|
|
|
*/ |
17
|
|
|
private $team; |
18
|
|
|
|
19
|
|
|
public function setUp() |
20
|
|
|
{ |
21
|
|
|
$this->team = new Team(); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
public function testTeamName() |
25
|
|
|
{ |
26
|
|
|
$expected = 'The A Team'; |
27
|
|
|
$this->assertNull($this->team->getTeamName()); |
28
|
|
|
$this->assertSame($this->team, $this->team->setTeamName($expected)); |
29
|
|
|
$this->assertEquals($expected, $this->team->getTeamName()); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function testAvatar() |
33
|
|
|
{ |
34
|
|
|
$expected = 'https://secure.wonnova.com/avatar'; |
35
|
|
|
$this->assertNull($this->team->getAvatar()); |
36
|
|
|
$this->assertSame($this->team, $this->team->setAvatar($expected)); |
37
|
|
|
$this->assertEquals($expected, $this->team->getAvatar()); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
View Code Duplication |
public function testDescription() |
|
|
|
|
41
|
|
|
{ |
42
|
|
|
$expected = 'Team\'s description'; |
43
|
|
|
$this->assertNull($this->team->getDescription()); |
44
|
|
|
$this->assertSame($this->team, $this->team->setDescription($expected)); |
45
|
|
|
$this->assertEquals($expected, $this->team->getDescription()); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function testScore() |
49
|
|
|
{ |
50
|
|
|
$expected = 300; |
51
|
|
|
$this->assertNull($this->team->getScore()); |
52
|
|
|
$this->assertSame($this->team, $this->team->setScore($expected)); |
53
|
|
|
$this->assertEquals($expected, $this->team->getScore()); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function testItsMe() |
57
|
|
|
{ |
58
|
|
|
$expected = true; |
59
|
|
|
$this->assertNull($this->team->getItsMe()); |
60
|
|
|
$this->assertSame($this->team, $this->team->setItsMe($expected)); |
61
|
|
|
$this->assertEquals($expected, $this->team->getItsMe()); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function testPosition() |
65
|
|
|
{ |
66
|
|
|
$expected = 3; |
67
|
|
|
$this->assertNull($this->team->getPosition()); |
68
|
|
|
$this->assertSame($this->team, $this->team->setPosition($expected)); |
69
|
|
|
$this->assertEquals($expected, $this->team->getPosition()); |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|
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.