@@ -45,7 +45,7 @@ class LastExtension extends DI\CompilerExtension
4545 function beforeCompile ()
4646 {
4747 // note that services should be added in loadConfiguration()
48- $ this ->getContainerBuilder ()->addDefinition ('one ' )
48+ $ this ->getContainerBuilder ()->addDefinition ($ this -> prefix ( 'one ' ) )
4949 ->setClass ('Service ' )
5050 ->setInject (TRUE );
5151 }
@@ -54,8 +54,12 @@ class LastExtension extends DI\CompilerExtension
5454
5555$ compiler = new DI \Compiler ;
5656$ compiler ->addExtension ('inject ' , new Nette \DI \Extensions \InjectExtension );
57+ $ compiler ->addExtension ('extensions ' , new Nette \DI \Extensions \ExtensionsExtension );
5758$ compiler ->addExtension ('last ' , new LastExtension );
5859$ container = createContainer ($ compiler , '
60+ extensions:
61+ ext: LastExtension
62+
5963services:
6064 - stdClass
6165 two:
@@ -75,7 +79,16 @@ Assert::equal([
7579 new Statement (['@self ' , 'injectC ' ]),
7680 new Statement (['@self ' , '$c ' ], ['@ \\stdClass ' ]),
7781 new Statement (['@self ' , '$a ' ], ['@ \\stdClass ' ]),
78- ], $ builder ->getDefinition ('one ' )->getSetup ());
82+ ], $ builder ->getDefinition ('last.one ' )->getSetup ());
83+
84+ Assert::equal ([
85+ new Statement (['@self ' , 'injectB ' ]),
86+ new Statement (['@self ' , 'injectA ' ]),
87+ new Statement (['@self ' , 'injectD ' ]),
88+ new Statement (['@self ' , 'injectC ' ]),
89+ new Statement (['@self ' , '$c ' ], ['@ \\stdClass ' ]),
90+ new Statement (['@self ' , '$a ' ], ['@ \\stdClass ' ]),
91+ ], $ builder ->getDefinition ('ext.one ' )->getSetup ());
7992
8093Assert::equal ([
8194 new Statement (['@self ' , 'injectB ' ], [1 ]),
0 commit comments