|
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; |
|
|
|
|
|
|
17
|
|
|
|
|
18
|
|
|
class RoleManagerTest extends TestCase |
|
19
|
|
|
{ |
|
20
|
|
|
const ROLE_CLASS = 'Eloyekunle\PermissionsBundle\Tests\TestUser'; |
|
21
|
|
|
|
|
22
|
|
|
/** @var \PHPUnit_Framework_MockObject_MockObject */ |
|
|
|
|
|
|
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
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths