Completed
Push — master ( 5b5dc4...6c5dbb )
by
unknown
9s
created

AddGuesserCompilerPassTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 19
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testProcess() 0 16 1
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\DoctrineORMAdminBundle\Tests\DependencyInjection\Compiler;
15
16
use PHPUnit\Framework\TestCase;
17
use Sonata\DoctrineORMAdminBundle\DependencyInjection\Compiler\AddGuesserCompilerPass;
18
use Symfony\Component\DependencyInjection\ContainerBuilder;
19
use Symfony\Component\DependencyInjection\Definition;
20
use Symfony\Component\DependencyInjection\Reference;
21
22
class AddGuesserCompilerPassTest extends TestCase
23
{
24
    public function testProcess(): void
25
    {
26
        $containerBuilder = $this->prophesize(ContainerBuilder::class);
27
        $definition = $this->prophesize(Definition::class);
28
        $definition->replaceArgument(0, [new Reference('some.id')])->shouldBeCalledTimes(3);
29
30
        $containerBuilder->getDefinition('sonata.admin.guesser.orm_list_chain')->willReturn($definition->reveal());
31
        $containerBuilder->getDefinition('sonata.admin.guesser.orm_datagrid_chain')->willReturn($definition->reveal());
32
        $containerBuilder->getDefinition('sonata.admin.guesser.orm_show_chain')->willReturn($definition->reveal());
33
34
        $containerBuilder->findTaggedServiceIds('sonata.admin.guesser.orm_list')->willReturn(['some.id' => 'attr']);
35
        $containerBuilder->findTaggedServiceIds('sonata.admin.guesser.orm_datagrid')->willReturn(['some.id' => 'attr']);
36
        $containerBuilder->findTaggedServiceIds('sonata.admin.guesser.orm_show')->willReturn(['some.id' => 'attr']);
37
38
        (new AddGuesserCompilerPass())->process($containerBuilder->reveal());
39
    }
40
}
41