Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Pull Request — master (#277)
by Jérémiah
14:57
created

DIContainerMockTrait::getDIContainerMock()   B

Complexity

Conditions 3
Paths 4

Size

Total Lines 26
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 26
rs 8.8571
c 0
b 0
f 0
cc 3
eloc 15
nc 4
nop 2
1
<?php
2
3
namespace Overblog\GraphQLBundle\Tests;
4
5
use Symfony\Component\DependencyInjection\Container;
6
7
/**
8
 * Class DIContainerMockTrait.
9
 *
10
 * @method \PHPUnit_Framework_MockObject_MockBuilder getMockBuilder (string $className)
11
 */
12
trait DIContainerMockTrait
13
{
14
    /**
15
     * @return null|\Symfony\Component\DependencyInjection\ContainerInterface
16
     */
17
    protected function getDIContainerMock(array $services = [], array $parameters = [])
18
    {
19
        $container = $this->getMockBuilder(Container::class)
20
            ->setMethods(['get', 'getParameter', 'has'])
21
            ->getMock();
22
23
        $getMethod = $container->expects($this->any())->method('get');
24
        $hasMethod = $container->expects($this->any())->method('has');
25
26
        foreach ($services as $id => $service) {
27
            $getMethod->with($id)->willReturn($service);
28
            $hasMethod->with($id)->willReturn(true);
29
        }
30
31
        $getParameterMethod = $container->expects($this->any())->method('getParameter');
32
33
        foreach ($parameters as $id => $parameter) {
34
            $getParameterMethod
35
                ->with($id)
36
                ->willReturn($parameter)
37
            ;
38
        }
39
40
        return $container;
41
    }
42
}
43