13
13
namespace Symfony \Cmf \Component \Testing \Functional ;
14
14
15
15
use Symfony \Bundle \FrameworkBundle \Test \WebTestCase ;
16
+ use Symfony \Bundle \FrameworkBundle \Client ;
16
17
use Symfony \Component \HttpFoundation \Response ;
17
18
use Symfony \Component \DependencyInjection \Container ;
18
19
25
26
abstract class BaseTestCase extends WebTestCase
26
27
{
27
28
/**
28
- * Use this property to save the DbManager.
29
+ * Use this property to save the DbManagers
30
+ *
31
+ * @var array
29
32
*/
30
- protected $ db ;
31
-
32
33
protected $ dbManagers = array ();
33
34
34
35
/**
35
36
* @var Container
36
37
*/
37
38
protected $ container ;
38
39
40
+ /**
41
+ * @var Client
42
+ */
43
+ protected $ client ;
44
+
39
45
/**
40
46
* Return the configuration to use when creating the Kernel.
41
47
*
@@ -51,6 +57,20 @@ protected function getKernelConfiguration()
51
57
return array ();
52
58
}
53
59
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
+
54
74
/**
55
75
* Gets the container.
56
76
*
@@ -59,8 +79,7 @@ protected function getKernelConfiguration()
59
79
public function getContainer ()
60
80
{
61
81
if (null === $ this ->container ) {
62
- $ client = $ this ->createClient ($ this ->getKernelConfiguration ());
63
- $ this ->container = $ client ->getContainer ();
82
+ $ this ->container = $ this ->getClient ()->getContainer ();
64
83
}
65
84
66
85
return $ this ->container ;
@@ -105,7 +124,7 @@ public function getDbManager($type)
105
124
106
125
$ this ->dbManagers [$ type ] = $ dbManager ;
107
126
108
- return $ this -> getDbManager ( $ type ) ;
127
+ return $ dbManager ;
109
128
}
110
129
111
130
/**
0 commit comments