12
12
namespace Symfony \Cmf \Component \Testing \Tests \Functional ;
13
13
14
14
use Doctrine \Bundle \PHPCRBundle \Test \RepositoryManager ;
15
+ use PHPUnit \Framework \MockObject \MockObject ;
15
16
use PHPUnit \Framework \TestCase ;
16
17
use Symfony \Bundle \FrameworkBundle \Client ;
18
+ use Symfony \Bundle \FrameworkBundle \KernelBrowser ;
17
19
use Symfony \Cmf \Component \Testing \Functional \DbManager \PHPCR ;
18
20
use Symfony \Cmf \Component \Testing \Tests \Fixtures \TestTestCase ;
19
21
use Symfony \Component \DependencyInjection \ContainerInterface ;
20
22
use Symfony \Component \HttpKernel \KernelInterface ;
21
23
22
24
class BaseTestCaseTest extends TestCase
23
25
{
26
+ /**
27
+ * @var ContainerInterface|MockObject
28
+ */
24
29
private $ container ;
25
30
31
+ /**
32
+ * @var KernelInterface|MockObject
33
+ */
26
34
private $ kernel ;
27
35
28
36
/**
29
37
* @var TestTestCase
30
38
*/
31
39
private $ testCase ;
32
40
41
+ /**
42
+ * @var KernelBrowser|Client|MockObject
43
+ */
33
44
private $ client ;
34
45
35
46
protected function setUp (): void
@@ -51,7 +62,12 @@ protected function setUp(): void
51
62
$ this ->testCase = new TestTestCase ();
52
63
$ this ->testCase ->setKernel ($ this ->kernel );
53
64
54
- $ this ->client = $ this ->createMock (Client::class);
65
+ if (class_exists (KernelBrowser::class)) {
66
+ $ this ->client = $ this ->createMock (KernelBrowser::class);
67
+ } else {
68
+ $ this ->client = $ this ->createMock (Client::class);
69
+ }
70
+
55
71
$ this ->client ->expects ($ this ->any ())
56
72
->method ('getContainer ' )
57
73
->willReturn ($ this ->container );
@@ -79,7 +95,11 @@ public function provideTestDb()
79
95
80
96
public function testItCanProvideAFrameworkBundleClient ()
81
97
{
82
- $ this ->assertInstanceOf (Client::class, $ this ->testCase ->getFrameworkBundleClient ());
98
+ if (class_exists (KernelBrowser::class)) {
99
+ $ this ->assertInstanceOf (KernelBrowser::class, $ this ->testCase ->getFrameworkBundleClient ());
100
+ } else {
101
+ $ this ->assertInstanceOf (Client::class, $ this ->testCase ->getFrameworkBundleClient ());
102
+ }
83
103
}
84
104
85
105
/**
0 commit comments