PermissionTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 40
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A setId() 0 7 1
A testId() 0 6 1
A testToString() 0 4 1
1
<?php
2
3
namespace JhUserTest\Entity;
4
5
use JhUser\Entity\Permission;
6
7
/**
8
 * Class PermissionTest
9
 * @package JhUserTest\Entity
10
 * @author Aydin Hassan <[email protected]>
11
 */
12
class PermissionTest extends \PHPUnit_Framework_TestCase
13
{
14
15
    /**
16
     * @var Permission
17
     */
18
    protected $permission;
19
20
    /**
21
     * SetUp
22
     */
23
    public function setUp()
24
    {
25
        $this->permission = new Permission('permission');
26
    }
27
28
    /**
29
     * @param Permission $permission
30
     * @param $id
31
     */
32
    public function setId(Permission $permission, $id)
33
    {
34
        $reflector = new \ReflectionClass($permission);
35
        $property  = $reflector->getProperty('id');
36
        $property->setAccessible(true);
37
        $property->setValue($permission, $id);
38
    }
39
40
    public function testId()
41
    {
42
        $this->assertNull($this->permission->getId());
43
        $this->setId($this->permission, 1);
44
        $this->assertEquals(1, $this->permission->getId());
45
    }
46
47
    public function testToString()
48
    {
49
        $this->assertSame('permission', $this->permission->__toString());
50
    }
51
}
52