4
4
5
5
use Symfony \Bundle \FrameworkBundle \Test \WebTestCase ;
6
6
7
+ /**
8
+ * The base class for Functional and Web tests.
9
+ *
10
+ * @author Daniel Leech <[email protected] >
11
+ * @author Wouter J <[email protected] >
12
+ */
7
13
abstract class BaseTestCase extends WebTestCase
8
14
{
15
+ /**
16
+ * Use this property to save the DbManager.
17
+ */
9
18
protected $ db ;
19
+
10
20
protected $ dbManagers = array ();
11
21
protected $ settings = array ();
12
22
protected $ containers = array ();
13
23
24
+ /**
25
+ * Configure the testcase.
26
+ *
27
+ * Currently, this is only used for creating a new kernel. This accepts
28
+ * 2 settings:
29
+ *
30
+ * * environment - The environment to use (defaults to 'phpcr')
31
+ * * debug - If debug should be enabled/disabled (defaults to true)
32
+ *
33
+ * @param array $options
34
+ */
14
35
protected function configure (array $ options )
15
36
{
16
37
$ this ->settings = $ options ;
17
38
}
18
39
40
+ /**
41
+ * Gets the container.
42
+ *
43
+ * @return \Symfony\Component\DependencyInjection\Container
44
+ */
19
45
public function getContainer ()
20
46
{
21
47
$ hash = md5 (serialize ($ this ->settings ));
@@ -28,11 +54,23 @@ public function getContainer()
28
54
return $ this ->containers [$ hash ];
29
55
}
30
56
57
+ /**
58
+ * Gets the DbManager.
59
+ *
60
+ * @see self::getDbManager
61
+ */
31
62
public function db ($ type )
32
63
{
33
64
return $ this ->getDbManager ($ type );
34
65
}
35
66
67
+ /**
68
+ * Gets the DbManager.
69
+ *
70
+ * @param string $type The Db type
71
+ *
72
+ * @return object
73
+ */
36
74
public function getDbManager ($ type )
37
75
{
38
76
if (isset ($ this ->dbManagers [$ type ])) {
@@ -60,6 +98,8 @@ public function getDbManager($type)
60
98
61
99
/**
62
100
* {@inheritDoc}
101
+ *
102
+ * This is overriden to set the default environment to 'phpcr'
63
103
*/
64
104
protected static function createKernel (array $ options = array ())
65
105
{
0 commit comments