Test Failed
Push — master ( 2c50f9...455c12 )
by Elijah
02:37
created

RoleManagerTest::setUp()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 23
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 17
nc 2
nop 0
dl 0
loc 23
rs 9.7
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the EloyekunlePermissionsBundle package.
5
 *
6
 * (c) Elijah Oyekunle <https://elijahoyekunle.com/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Eloyekunle\PermissionsBundle\Tests\Model;
13
14
use Eloyekunle\PermissionsBundle\Doctrine\RoleManager;
15
use Eloyekunle\PermissionsBundle\Model\RoleManagerInterface;
16
use PHPUnit\Framework\TestCase;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
18
class RoleManagerTest extends TestCase
19
{
20
    const ROLE_CLASS = 'Eloyekunle\PermissionsBundle\Tests\TestUser';
21
22
    /** @var \PHPUnit_Framework_MockObject_MockObject */
0 ignored issues
show
Bug introduced by
The type PHPUnit_Framework_MockObject_MockObject was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
23
    protected $repository;
24
25
    /** @var \PHPUnit_Framework_MockObject_MockObject */
26
    protected $om;
27
28
    /** @var RoleManagerInterface */
29
    protected $roleManager;
30
31
    public function setUp()
32
    {
33
        if (!interface_exists('Doctrine\Common\Persistence\ObjectManager')) {
34
            $this->markTestSkipped('Doctrine Common has to be installed for this test to run.');
35
        }
36
37
        $class = $this->getMockBuilder('Doctrine\Common\Persistence\Mapping\ClassMetadata')->getMock();
38
        $this->om = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager')->getMock();
39
        $this->repository = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectRepository')->getMock();
40
41
        $this->om->expects($this->any())
42
            ->method('getRepository')
43
            ->with($this->equalTo(static::ROLE_CLASS))
44
            ->will($this->returnValue($this->repository));
45
        $this->om->expects($this->any())
46
            ->method('getClassMetadata')
47
            ->with($this->equalTo(static::ROLE_CLASS))
48
            ->will($this->returnValue($class));
49
        $class->expects($this->any())
50
            ->method('getName')
51
            ->will($this->returnValue(static::ROLE_CLASS));
52
53
        $this->roleManager = new RoleManager($this->om, $class);
54
    }
55
}
56