Completed
Pull Request — master (#125)
by Guillaume
09:40
created

testAutoConfigurationCannotBeDone()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.7
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 SymfonyExtension package.
7
 *
8
 * (c) Kamil Kokot <[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 Tests\ServiceContainer;
15
16
use Behat\Behat\Context\Context;
17
use FriendsOfBehat\SymfonyExtension\ServiceContainer\SymfonyExtension;
18
use PHPUnit\Framework\TestCase;
19
use Symfony\Component\DependencyInjection\ContainerBuilder;
20
21
final class ServiceContainerTest extends TestCase
22
{
23
    public function testAutoConfigurationCannotBeDone(): void
24
    {
25
        $container = $this->createMock(ContainerBuilder::class);
26
        $container->expects(self::never())->method('registerForAutoconfiguration');
27
        $container->expects(self::never())->method('findTaggedServiceIds');
28
29
        $extension = new SymfonyExtension();
30
        $extension->load($container, [
0 ignored issues
show
Documentation introduced by
$container is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Symfony\Component...ction\ContainerBuilder>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
31
            'bootstrap' => null,
32
            'kernel' => [
33
                'class' => 'Kernel',
34
                'path' => 'src/',
35
            ],
36
            'autoconfigure' => false,
37
            'step_autowiring' => false,
38
        ]);
39
    }
40
41
    public function testAutoConfigurationCanBeDone(): void
42
    {
43
    }
44
}
45
46
final class FooContext implements Context
47
{
48
}
49