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