PlayerTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 4
dl 0
loc 49
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A tearDown() 0 4 1
A testEquals() 0 14 1
A testSetTeam() 0 8 1
A testSetPlayerSkills() 0 7 1
1
<?php
2
3
namespace OSS\CoreBundle\Tests\Entity;
4
5
use OSS\CoreBundle\Entity\Player;
6
use OSS\CoreBundle\Entity\PlayerSkills;
7
use OSS\CoreBundle\Entity\Team;
8
9
class PlayerTest extends \PHPUnit_Framework_TestCase
10
{
11
    /**
12
     * @var Player
13
     */
14
    private $player;
15
16
    public function setUp()
17
    {
18
        $this->player = new Player();
19
    }
20
21
    public function tearDown()
22
    {
23
        $this->player = null;
24
    }
25
26
    public function testEquals()
27
    {
28
        $player2 = new Player();
29
30
        $this->assertTrue($this->player->equals($player2));
31
32
        $this->player->setId(1);
33
        $player2->setId(1);
34
        $this->assertTrue($this->player->equals($player2));
35
36
        $this->player->setId(1);
37
        $player2->setId(2);
38
        $this->assertFalse($this->player->equals($player2));
39
    }
40
41
    public function testSetTeam()
42
    {
43
        $team = new Team();
44
45
        $this->player->setTeam($team);
46
        $this->assertEquals($team, $this->player->getTeam());
47
        $this->assertContains($this->player, $team->getPlayers());
48
    }
49
50
    public function testSetPlayerSkills()
51
    {
52
        $playerSkills = new PlayerSkills();
53
        $this->player->setSkills($playerSkills);
54
        $this->assertEquals($playerSkills, $this->player->getSkills());
55
        $this->assertEquals($this->player, $playerSkills->getPlayer());
56
    }
57
}
58