@@ -14,7 +14,7 @@ protected function registerCompilerPass(ContainerBuilder $container)
1414 $ container ->addCompilerPass (new AutoRoutePass ());
1515 }
1616
17- public function testRegistration ()
17+ public function testServiceRegistration ()
1818 {
1919 $ serviceRegistryDefinition = new Definition ();
2020 $ this ->setDefinition ('cmf_routing_auto.service_registry ' , $ serviceRegistryDefinition );
@@ -32,6 +32,36 @@ public function testRegistration()
3232 new Reference ('some_token_provider ' )
3333 )
3434 );
35+ }
36+
37+ /**
38+ * @expectedException \RuntimeException
39+ * @expectedExceptionMessage Could not find configured adapter "bar", available adapters: "foobar"
40+ */
41+ public function testAdapterRegistrationUnknownAdapter ()
42+ {
43+ $ managerDef = new Definition ();
44+ $ this ->setDefinition ('cmf_routing_auto.auto_route_manager ' , $ managerDef );
45+ $ this ->container ->setParameter ('cmf_routing_auto.adapter_name ' , 'bar ' );
46+
47+ $ adapterDef = new Definition ();
48+ $ adapterDef ->addTag ('cmf_routing_auto.adapter ' , array ('alias ' => 'foobar ' ));
49+ $ this ->setDefinition ('some_adapter ' , $ adapterDef );
50+ $ this ->compile ();
51+ }
52+
53+ public function testAdapterRegistration ()
54+ {
55+ $ managerDef = new Definition ();
56+ $ managerDef ->setArguments (array (0 , 1 , 2 ));
57+ $ this ->setDefinition ('cmf_routing_auto.auto_route_manager ' , $ managerDef );
58+ $ this ->container ->setParameter ('cmf_routing_auto.adapter ' , 'foobar ' );
59+
60+ $ adapterDef = new Definition ();
61+ $ adapterDef ->addTag ('cmf_routing_auto.adapter ' , array ('alias ' => 'foobar ' ));
62+ $ this ->setDefinition ('some_adapter ' , $ adapterDef );
63+ $ this ->compile ();
3564
65+ $ this ->assertEquals (new Reference ('some_adapter ' ), $ managerDef ->getArgument (0 ));
3666 }
3767}
0 commit comments