1818use Fig \Http \Message \RequestMethodInterface ;
1919use Fig \Http \Message \StatusCodeInterface ;
2020use Laminas \Diactoros \ServerRequest ;
21- use Laminas \ServiceManager \ServiceManager ;
2221use Mezzio \Application ;
2322use Mezzio \MiddlewareFactory ;
2423use PHPUnit \Framework \TestCase ;
3130
3231use function array_merge ;
3332use function getenv ;
34- use function method_exists ;
3533use function putenv ;
3634use function realpath ;
3735
@@ -41,7 +39,7 @@ class AbstractFunctionalTest extends TestCase
4139 use DatabaseTrait;
4240
4341 protected Application $ app ;
44- protected ContainerInterface | ServiceManager $ container ;
42+ protected ContainerInterface $ container ;
4543 protected const DEFAULT_PASSWORD = 'dotkernel ' ;
4644
4745 /**
@@ -59,12 +57,8 @@ public function setUp(): void
5957
6058 $ this ->ensureTestMode ();
6159
62- if (method_exists ($ this , 'runMigrations ' )) {
63- $ this ->runMigrations ();
64- }
65- if (method_exists ($ this , 'runSeeders ' )) {
66- $ this ->runSeeders ();
67- }
60+ $ this ->runMigrations ();
61+ $ this ->runSeeders ();
6862 }
6963
7064 public function tearDown (): void
@@ -132,7 +126,7 @@ protected function getEntityManager(): EntityManagerInterface
132126 return $ this ->container ->get (EntityManagerInterface::class);
133127 }
134128
135- protected function getContainer (): ContainerInterface | ServiceManager
129+ protected function getContainer (): ContainerInterface
136130 {
137131 return $ this ->container ;
138132 }
@@ -150,7 +144,7 @@ private function ensureTestMode(): void
150144 );
151145 }
152146
153- if (! $ this ->getEntityManager ()->getConnection ()->getParams ()['memory ' ] ?? false ) {
147+ if (! ( $ this ->getEntityManager ()->getConnection ()->getParams ()['memory ' ] ?? false ) ) {
154148 throw new RuntimeException (
155149 'You are running tests in a non in-memory database. Did you forget to create local.test.php? '
156150 );
@@ -271,7 +265,7 @@ private function createRequest(
271265 string $ body = 'php://input ' ,
272266 string $ protocol = '1.1 '
273267 ): ServerRequestInterface {
274- if (method_exists ( $ this , ' isAuthenticated ' ) && $ this ->isAuthenticated ()) {
268+ if ($ this ->isAuthenticated ()) {
275269 $ headers = array_merge ($ headers , $ this ->getAuthorizationHeader ());
276270 }
277271
0 commit comments