44
55namespace Facile \SymfonyFunctionalTestCase ;
66
7- use Symfony \Bundle \FrameworkBundle \Client ;
87use Symfony \Bundle \FrameworkBundle \Console \Application ;
8+ use Symfony \Bundle \FrameworkBundle \KernelBrowser ;
99use Symfony \Bundle \FrameworkBundle \Test \WebTestCase as BaseWebTestCase ;
1010use Symfony \Component \Console \Tester \CommandTester ;
1111use Symfony \Component \DependencyInjection \ContainerInterface ;
12- use Symfony \Component \DependencyInjection \ResettableContainerInterface ;
1312use Symfony \Component \HttpFoundation \Response ;
1413
14+ if (! class_exists (KernelBrowser::class)) {
15+ \class_alias (\Symfony \Bundle \FrameworkBundle \Client::class, KernelBrowser::class);
16+ }
17+
1518abstract class WebTestCase extends BaseWebTestCase
1619{
1720 /** @var string */
@@ -80,23 +83,23 @@ protected function getContainer(): ContainerInterface
8083 * $client matches the expected code. If not, raises an error with more
8184 * information.
8285 */
83- public function assertStatusCode (int $ expectedStatusCode , Client $ client , string $ message = '' ): void
86+ public function assertStatusCode (int $ expectedStatusCode , KernelBrowser $ client , string $ message = '' ): void
8487 {
8588 $ response = $ client ->getResponse ();
8689
8790 $ this ->assertInstanceOf (Response::class, $ response , 'Response missing from client ' );
8891 $ this ->assertSame ($ expectedStatusCode , $ response ->getStatusCode (), $ message );
8992 }
9093
91- protected function assertStatusCodeIsSuccessful (Client $ client ): void
94+ protected function assertStatusCodeIsSuccessful (KernelBrowser $ client ): void
9295 {
9396 $ response = $ client ->getResponse ();
9497
9598 $ this ->assertInstanceOf (Response::class, $ response , 'Response missing from client ' );
9699 $ this ->assertTrue ($ response ->isSuccessful (), 'HTTP status code not successful: ' . $ response ->getStatusCode ());
97100 }
98101
99- protected function assertStatusCodeIsRedirect (Client $ client ): void
102+ protected function assertStatusCodeIsRedirect (KernelBrowser $ client ): void
100103 {
101104 $ response = $ client ->getResponse ();
102105
@@ -107,7 +110,7 @@ protected function assertStatusCodeIsRedirect(Client $client): void
107110 protected function tearDown (): void
108111 {
109112 foreach ($ this ->containers as $ container ) {
110- if ($ container instanceof ResettableContainerInterface ) {
113+ if (method_exists ( $ container, ' reset ' ) ) {
111114 $ container ->reset ();
112115 }
113116 }
0 commit comments