1717use Symfony \Component \DependencyInjection \Compiler \ResolveBindingsPass ;
1818use Symfony \Component \DependencyInjection \ContainerBuilder ;
1919use Symfony \Component \DependencyInjection \Definition ;
20- use Symfony \Component \DependencyInjection \Exception \RuntimeException ;
2120use Symfony \Component \DependencyInjection \Reference ;
2221use Symfony \Component \DependencyInjection \Tests \Fixtures \CaseSensitiveClass ;
2322use Symfony \Component \DependencyInjection \Tests \Fixtures \NamedArgumentsDummy ;
2423use Symfony \Component \DependencyInjection \Tests \Fixtures \ParentNotExists ;
2524use Symfony \Component \DependencyInjection \TypedReference ;
26- use Symfony \Component \HttpKernel \HttpKernelInterface ;
2725
2826require_once __DIR__ .'/../Fixtures/includes/autowiring_classes.php ' ;
2927
@@ -115,6 +113,10 @@ public function testScalarSetter()
115113 $ this ->assertEquals ([['setDefaultLocale ' , ['fr ' ]]], $ definition ->getMethodCalls ());
116114 }
117115
116+ /**
117+ * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
118+ * @exceptedExceptionMessage Invalid service "Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy": method "setLogger()" does not exist.
119+ */
118120 public function testWithNonExistingSetterAndBinding ()
119121 {
120122 $ container = new ContainerBuilder ();
@@ -123,36 +125,11 @@ public function testWithNonExistingSetterAndBinding()
123125 '$c ' => (new Definition ('logger ' ))->setFactory ('logger ' ),
124126 ];
125127
126- $ definition = $ container ->register (HttpKernelInterface::class, HttpKernelInterface::class);
127- $ definition ->addMethodCall ('setLogger ' );
128- $ definition ->setBindings ($ bindings );
129- $ this ->expectException (RuntimeException::class);
130-
131- $ pass = new ResolveBindingsPass ();
132- $ pass ->process ($ container );
133- }
134-
135- public function testTupleBinding ()
136- {
137- $ container = new ContainerBuilder ();
138-
139- $ bindings = [
140- '$c ' => new BoundArgument (new Reference ('bar ' )),
141- CaseSensitiveClass::class.'$c ' => new BoundArgument (new Reference ('foo ' )),
142- ];
143-
144128 $ definition = $ container ->register (NamedArgumentsDummy::class, NamedArgumentsDummy::class);
145- $ definition ->addMethodCall ('setSensitiveClass ' );
146- $ definition ->addMethodCall ('setAnotherC ' );
129+ $ definition ->addMethodCall ('setLogger ' );
147130 $ definition ->setBindings ($ bindings );
148131
149132 $ pass = new ResolveBindingsPass ();
150133 $ pass ->process ($ container );
151-
152- $ expected = [
153- ['setSensitiveClass ' , [new Reference ('foo ' )]],
154- ['setAnotherC ' , [new Reference ('bar ' )]],
155- ];
156- $ this ->assertEquals ($ expected , $ definition ->getMethodCalls ());
157134 }
158135}
0 commit comments