@@ -23,17 +23,63 @@ public function testProcess()
2323 $ container = new ContainerBuilder ();
2424 $ def = $ container
2525 ->register ('foo ' )
26- ->setArguments (array (new Reference ('bar ' , ContainerInterface::NULL_ON_INVALID_REFERENCE )))
26+ ->setArguments (array (
27+ new Reference ('bar ' , ContainerInterface::NULL_ON_INVALID_REFERENCE ),
28+ new Reference ('baz ' , ContainerInterface::IGNORE_ON_INVALID_REFERENCE ),
29+ ))
2730 ->addMethodCall ('foo ' , array (new Reference ('moo ' , ContainerInterface::IGNORE_ON_INVALID_REFERENCE )))
2831 ;
2932
3033 $ this ->process ($ container );
3134
3235 $ arguments = $ def ->getArguments ();
33- $ this ->assertNull ( $ arguments[ 0 ] );
36+ $ this ->assertSame ( array ( null , null ), $ arguments );
3437 $ this ->assertCount (0 , $ def ->getMethodCalls ());
3538 }
3639
40+ public function testProcessIgnoreInvalidArgumentInCollectionArgument ()
41+ {
42+ $ container = new ContainerBuilder ();
43+ $ container ->register ('baz ' );
44+ $ def = $ container
45+ ->register ('foo ' )
46+ ->setArguments (array (
47+ array (
48+ new Reference ('bar ' , ContainerInterface::IGNORE_ON_INVALID_REFERENCE ),
49+ $ baz = new Reference ('baz ' , ContainerInterface::IGNORE_ON_INVALID_REFERENCE ),
50+ new Reference ('moo ' , ContainerInterface::NULL_ON_INVALID_REFERENCE ),
51+ ),
52+ ))
53+ ;
54+
55+ $ this ->process ($ container );
56+
57+ $ arguments = $ def ->getArguments ();
58+ $ this ->assertSame (array ($ baz , null ), $ arguments [0 ]);
59+ }
60+
61+ public function testProcessKeepMethodCallOnInvalidArgumentInCollectionArgument ()
62+ {
63+ $ container = new ContainerBuilder ();
64+ $ container ->register ('baz ' );
65+ $ def = $ container
66+ ->register ('foo ' )
67+ ->addMethodCall ('foo ' , array (
68+ array (
69+ new Reference ('bar ' , ContainerInterface::IGNORE_ON_INVALID_REFERENCE ),
70+ $ baz = new Reference ('baz ' , ContainerInterface::IGNORE_ON_INVALID_REFERENCE ),
71+ new Reference ('moo ' , ContainerInterface::NULL_ON_INVALID_REFERENCE ),
72+ ),
73+ ))
74+ ;
75+
76+ $ this ->process ($ container );
77+
78+ $ calls = $ def ->getMethodCalls ();
79+ $ this ->assertCount (1 , $ def ->getMethodCalls ());
80+ $ this ->assertSame (array ($ baz , null ), $ calls [0 ][1 ][0 ]);
81+ }
82+
3783 public function testProcessIgnoreNonExistentServices ()
3884 {
3985 $ container = new ContainerBuilder ();
0 commit comments