1313namespace Symfony \Cmf \Component \Testing \Functional ;
1414
1515use Symfony \Bundle \FrameworkBundle \Test \WebTestCase ;
16+ use Symfony \Bundle \FrameworkBundle \Client ;
17+ use Symfony \Component \HttpFoundation \Response ;
1618use Symfony \Component \DependencyInjection \Container ;
1719
1820/**
2426abstract class BaseTestCase extends WebTestCase
2527{
2628 /**
27- * Use this property to save the DbManager.
29+ * Use this property to save the DbManagers
30+ *
31+ * @var array
2832 */
29- protected $ db ;
30-
3133 protected $ dbManagers = array ();
3234
3335 /**
3436 * @var Container
3537 */
3638 protected $ container ;
3739
40+ /**
41+ * @var Client
42+ */
43+ protected $ client ;
44+
3845 /**
3946 * Return the configuration to use when creating the Kernel.
4047 *
@@ -50,6 +57,20 @@ protected function getKernelConfiguration()
5057 return array ();
5158 }
5259
60+ /**
61+ * Gets the Client.
62+ *
63+ * @return Client
64+ */
65+ public function getClient ()
66+ {
67+ if (null === $ this ->client ) {
68+ $ this ->client = $ this ->createClient ($ this ->getKernelConfiguration ());
69+ }
70+
71+ return $ this ->client ;
72+ }
73+
5374 /**
5475 * Gets the container.
5576 *
@@ -58,8 +79,7 @@ protected function getKernelConfiguration()
5879 public function getContainer ()
5980 {
6081 if (null === $ this ->container ) {
61- $ client = $ this ->createClient ($ this ->getKernelConfiguration ());
62- $ this ->container = $ client ->getContainer ();
82+ $ this ->container = $ this ->getClient ()->getContainer ();
6383 }
6484
6585 return $ this ->container ;
@@ -104,7 +124,7 @@ public function getDbManager($type)
104124
105125 $ this ->dbManagers [$ type ] = $ dbManager ;
106126
107- return $ this -> getDbManager ( $ type ) ;
127+ return $ dbManager ;
108128 }
109129
110130 /**
0 commit comments