10
10
*/
11
11
12
12
13
- namespace Tests \Functional ;
13
+ namespace Symfony \ Cmf \ Component \ Testing \ Tests \Functional ;
14
14
15
+ use Symfony \Cmf \Component \Testing \Tests \Fixtures \TestTestCase ;
15
16
use Symfony \Cmf \Component \Testing \HttpKernel \TestKernel ;
16
17
use Symfony \Component \Config \Loader \LoaderInterface ;
17
18
18
19
class BaseTestCaseTest extends \PHPUnit_Framework_TestCase
19
20
{
20
21
public function setUp ()
21
22
{
22
- $ me = $ this ;
23
-
24
- $ this ->tc = $ this ->getMockBuilder (
25
- 'Symfony\Cmf\Component\Testing\Functional\BaseTestCase '
26
- )->setMethods (array (
27
- 'createKernel ' ,
28
- ))->getMockForAbstractClass ();
23
+ $ this ->testCase = new TestTestCase ();
29
24
30
- $ this ->container = $ this ->getMock (
31
- 'Symfony\Component\DependencyInjection\ContainerInterface '
32
- );
33
-
34
- $ this ->kernel = $ this ->getMock (
35
- 'Symfony\Component\HttpKernel\KernelInterface '
36
- );
37
-
38
- $ this ->client = $ me ->getMockBuilder (
39
- 'Symfony\Bundle\FrameworkBundle\Client '
40
- )->disableOriginalConstructor ()->getMock ();
25
+ $ this ->container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
41
26
27
+ $ me = $ this ;
42
28
$ this ->container ->expects ($ this ->any ())
43
29
->method ('get ' )
44
30
->will ($ this ->returnCallback (function ($ name ) use ($ me ) {
45
31
$ dic = array (
46
- 'test.client ' => $ me ->client
32
+ 'test.client ' => $ me ->client ,
47
33
);
48
34
49
35
return $ dic [$ name ];
50
36
}));
51
37
38
+ $ this ->kernel = $ this ->getMock ('Symfony\Component\HttpKernel\KernelInterface ' );
39
+
40
+ $ this ->testCase ->setKernel ($ this ->kernel );
41
+
52
42
$ this ->kernel ->expects ($ this ->any ())
53
43
->method ('getContainer ' )
54
44
->will ($ this ->returnValue ($ this ->container ));
55
45
56
- $ tc = $ this ->tc ;
57
- $ tc ::staticExpects ($ this ->any ())
58
- ->method ('createKernel ' )
59
- ->will ($ this ->returnValue ($ this ->kernel ));
46
+ $ this ->client = $ this ->getMockBuilder ('Symfony\Bundle\FrameworkBundle\Client ' )
47
+ ->disableOriginalConstructor ()
48
+ ->getMock ();
60
49
61
50
$ this ->client ->expects ($ this ->any ())
62
51
->method ('getContainer ' )
@@ -66,8 +55,7 @@ public function setUp()
66
55
67
56
public function testGetContainer ()
68
57
{
69
- $ res = $ this ->tc ->getContainer ();
70
- $ this ->assertEquals ($ this ->container , $ res );
58
+ $ this ->assertEquals ($ this ->container , $ this ->testCase ->getContainer ());
71
59
}
72
60
73
61
public function provideTestDb ()
@@ -87,12 +75,10 @@ public function provideTestDb()
87
75
public function testDb ($ dbName , $ expected )
88
76
{
89
77
if (null === $ expected ) {
90
- $ this ->setExpectedException ('InvalidArgumentException ' ,
91
- $ dbName .'" does not exist '
92
- );
78
+ $ this ->setExpectedException ('InvalidArgumentException ' , $ dbName .'" does not exist ' );
93
79
}
94
80
95
- $ res = $ this ->tc ->getDbManager ($ dbName );
81
+ $ res = $ this ->testCase ->getDbManager ($ dbName );
96
82
97
83
$ className = sprintf (
98
84
'Symfony\Cmf\Component\Testing\Functional\DbManager\%s ' ,
0 commit comments