PlayerTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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