@@ -35,7 +35,7 @@ protected function setUp()
3535 }
3636
3737 /**
38- * @expectedException Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
38+ * @expectedException \ Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
3939 */
4040 public function testNoProvider ()
4141 {
@@ -187,7 +187,7 @@ public function testCacheMissTtl()
187187 $ this ->extension ->load ($ config , $ this ->container );
188188 }
189189
190- public function testCache ()
190+ public function testDoctrineCacheProvider ()
191191 {
192192 $ config = array (
193193 'florianv_swap ' => array (
@@ -212,6 +212,31 @@ public function testCache()
212212 $ this ->assertEquals (array ($ apcDefinition , 3600 ), $ cache ->getArguments ());
213213 }
214214
215+ public function testDoctrineCacheService ()
216+ {
217+ $ config = array (
218+ 'florianv_swap ' => array (
219+ 'cache ' => array (
220+ 'ttl ' => 60 ,
221+ 'doctrine ' => 'my_service ' ,
222+ ),
223+ 'providers ' => array ('yahoo_finance ' => null )
224+ )
225+ );
226+ $ this ->extension ->load ($ config , $ this ->container );
227+
228+ $ swap = $ this ->container ->getDefinition ('florianv_swap.swap ' );
229+ $ arguments = $ swap ->getArguments ();
230+ $ cache = $ arguments [1 ];
231+ $ cacheArguments = $ cache ->getArguments ();
232+
233+ $ this ->assertEquals ($ cache ->getClass (), '%florianv_swap.cache.doctrine.class% ' );
234+ $ this ->assertFalse ($ cache ->isPublic ());
235+
236+ $ this ->assertEquals (new Reference ('my_service ' ), $ cacheArguments [0 ]);
237+ $ this ->assertEquals (60 , $ cacheArguments [1 ]);
238+ }
239+
215240 private function createProvidersConfig (array $ providers )
216241 {
217242 return array ('florianv_swap ' => array ('providers ' => $ providers ));
0 commit comments