PermissionTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testItCreate() 0 8 1
A testItCreateWithoutDescription() 0 7 1
1
<?php declare(strict_types=1);
2
/*
3
 * This file is part of FlexPHP.
4
 *
5
 * (c) Freddie Gar <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace FlexPHP\GRBAC\Tests\Unit;
11
12
use FlexPHP\GRBAC\Permission;
13
use FlexPHP\GRBAC\Tests\TestCase;
14
15
final class PermissionTest extends TestCase
16
{
17
    public function testItCreate(): void
18
    {
19
        $slug = 'create';
20
        $description = 'Create a new resource';
21
        $permission = new Permission($slug, $description);
22
23
        $this->assertEquals($slug, $permission->slug());
24
        $this->assertEquals($description, $permission->description());
25
    }
26
27
    public function testItCreateWithoutDescription(): void
28
    {
29
        $slug = 'create';
30
        $permission = new Permission($slug);
31
32
        $this->assertEquals($slug, $permission->slug());
33
        $this->assertEquals(null, $permission->description());
34
    }
35
}
36