1 | <?php |
||
2 | |||
3 | /* |
||
4 | * |
||
5 | * (c) Yaroslav Honcharuk <[email protected]> |
||
6 | * |
||
7 | * For the full copyright and license information, please view the LICENSE |
||
8 | * file that was distributed with this source code. |
||
9 | */ |
||
10 | |||
11 | namespace Yarhon\RouteGuardBundle\Tests\DependencyInjection\Compiler; |
||
12 | |||
13 | use PHPUnit\Framework\TestCase; |
||
14 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
||
15 | use Yarhon\RouteGuardBundle\DependencyInjection\Compiler\ContainerClassMapPass; |
||
16 | use Yarhon\RouteGuardBundle\DependencyInjection\Container\ClassMap; |
||
17 | use Yarhon\RouteGuardBundle\DependencyInjection\Container\ClassMapBuilder; |
||
18 | |||
19 | /** |
||
20 | * @author Yaroslav Honcharuk <[email protected]> |
||
21 | */ |
||
22 | class ContainerClassMapPassTest extends TestCase |
||
23 | { |
||
24 | /** |
||
25 | * @var ContainerBuilder |
||
26 | */ |
||
27 | private $container; |
||
28 | |||
29 | /** |
||
30 | * @var ContainerClassMapPass |
||
31 | */ |
||
32 | private $pass; |
||
33 | |||
34 | public function setUp() |
||
35 | { |
||
36 | $this->container = new ContainerBuilder(); |
||
37 | |||
38 | $classMapBuilder = $this->createMock(ClassMapBuilder::class); |
||
39 | $classMapBuilder->method('build') |
||
0 ignored issues
–
show
|
|||
40 | ->willReturn(['test_service' => 'test_class']); |
||
41 | |||
42 | $this->pass = new ContainerClassMapPass($classMapBuilder); |
||
43 | |||
44 | $this->container->register(ClassMap::class) |
||
45 | ->setArgument(0, []) |
||
46 | ->setPublic(true); |
||
47 | } |
||
48 | |||
49 | public function testProcess() |
||
50 | { |
||
51 | $this->container->compile(); |
||
52 | $this->pass->process($this->container); |
||
53 | |||
54 | $definition = $this->container->getDefinition(ClassMap::class); |
||
55 | $arguments = $definition->getArguments(); |
||
56 | |||
57 | $this->assertCount(1, $arguments); |
||
58 | |||
59 | $expected = [ |
||
60 | 'test_service' => 'test_class', |
||
61 | ]; |
||
62 | |||
63 | $this->assertArraySubset($expected, $arguments[0]); |
||
64 | } |
||
65 | } |
||
66 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.