Completed
Push — 2.0 ( d81882...c954a2 )
by Nicolas
15:27
created

PermissionManagerTest::getModulesRepositoryMock()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Modules\User\Tests\Permissions;
4
5
use Mockery;
6
use Modules\Core\Tests\BaseTestCase;
7
use Modules\User\Permissions\PermissionManager;
8
9
class PermissionManagerTest extends BaseTestCase
10
{
11
    /**
12
     * @test
13
     */
14
    public function it_should_clean_permissions()
15
    {
16
        $input = [
17
            'permission1' => '1',
18
            'permission2' => '1',
19
            'permission3' => '-1',
20
            'permission4' => '-1',
21
            'permission5' => '0',
22
            'permission6' => '0',
23
        ];
24
25
        $expected = [
26
            'permission1' => true,
27
            'permission2' => true,
28
            'permission3' => false,
29
            'permission4' => false,
30
        ];
31
32
        $manager = new PermissionManager();
33
34
        $actual = $manager->clean($input);
35
36
        $this->assertSame($expected, $actual, 'The PermissionManager should clean the permissions and fix their states.');
37
    }
38
}
39