1 | <?php |
||
24 | class GoAopBundleTest extends TestCase |
||
25 | { |
||
26 | /** |
||
27 | * @test |
||
28 | * @expectedException \InvalidArgumentException |
||
29 | */ |
||
30 | public function itThrowsExceptionWhenBundleIsNotRegisteredAsFirstBundle() |
||
45 | |||
46 | /** |
||
47 | * @test |
||
48 | */ |
||
49 | public function itRegistersAspectCollectorPassPass() |
||
50 | { |
||
51 | $container = $this->getMockBuilder(ContainerBuilder::class)->getMock(); |
||
52 | |||
53 | $container |
||
54 | ->method('getParameter') |
||
55 | ->with('kernel.bundles') |
||
56 | ->willReturn(['GoAopBundle' => 'A bundle']); |
||
57 | |||
58 | $container |
||
59 | ->expects($spy = $this->exactly(1)) |
||
60 | ->method('addCompilerPass'); |
||
61 | |||
62 | $bundle = new GoAopBundle(); |
||
63 | |||
64 | $bundle->getName(); // invoke resolution of bundle name |
||
65 | |||
66 | $bundle->build($container); |
||
67 | |||
68 | $invocation = $spy->getInvocations()[0]; |
||
69 | $this->assertInstanceOf(AspectCollectorPass::class, $invocation->parameters[0]); |
||
|
|||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @test |
||
74 | * @runInSeparateProcess |
||
75 | */ |
||
76 | public function itBoots() |
||
100 | |||
101 | /** |
||
102 | * @test |
||
103 | * @runInSeparateProcess |
||
104 | * @expectedException \RuntimeException |
||
105 | * @expectedExceptionMessage Initialization of AOP loader was failed, probably due to Debug::enable() |
||
106 | */ |
||
107 | public function itThrowsExceptionOnBootWithoutAopComposerLoader() |
||
126 | } |
||
127 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: