Completed
Push — 3.x ( 1cd1d0...b03505 )
by Grégoire
16:27 queued 03:11
created

ModelManagerCompilerPassTest::testProcess()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\AdminBundle\Tests\DependencyInjection;
15
16
use PHPUnit\Framework\TestCase;
17
use Prophecy\Argument;
18
use Sonata\AdminBundle\DependencyInjection\Compiler\ModelManagerCompilerPass;
19
use Sonata\AdminBundle\Maker\AdminMaker;
20
use Symfony\Component\DependencyInjection\ContainerBuilder;
21
use Symfony\Component\DependencyInjection\Definition;
22
23
/**
24
 * @author Gaurav Singh Faujdar <[email protected]>
25
 */
26
class ModelManagerCompilerPassTest extends TestCase
27
{
28
    /**
29
     * @var AdminMaker
30
     */
31
    private $adminMaker;
32
33
    public function setUp(): void
34
    {
35
        if (!class_exists('Symfony\Component\Console\CommandLoader\CommandLoaderInterface')) {
36
            $this->markTestSkipped('Test only available for SF 3.4');
37
        }
38
39
        parent::setUp();
40
        $this->adminMaker = $this->prophesize(Definition::class);
41
        $this->adminMaker->replaceArgument(Argument::type('integer'), Argument::any())->shouldBeCalledTimes(2);
42
    }
43
44
    public function testProcess(): void
45
    {
46
        $containerBuilderMock = $this->prophesize(ContainerBuilder::class);
47
48
        $containerBuilderMock->getDefinition(Argument::exact('sonata.admin.maker'))
49
            ->willReturn($this->adminMaker);
50
51
        $containerBuilderMock->hasDefinition(Argument::containingString('sonata.admin.manager'))
52
            ->willReturn(null);
53
        $containerBuilderMock->getDefinition(Argument::containingString('sonata.admin.manager'))
54
            ->willReturn(null);
55
        $containerBuilderMock->getParameter(Argument::containingString('kernel.project_dir'))
56
            ->willReturn(null);
57
58
        $compilerPass = new ModelManagerCompilerPass();
59
        $compilerPass->process($containerBuilderMock->reveal());
60
61
        $this->verifyMockObjects();
0 ignored issues
show
Bug introduced by
The method verifyMockObjects() cannot be called from this context as it is declared private in class PHPUnit\Framework\TestCase.

This check looks for access to methods that are not accessible from the current context.

If you need to make a method accessible to another context you can raise its visibility level in the defining class.

Loading history...
62
    }
63
}
64