120120 */
121121class Symfony extends Framework implements DoctrineProvider, PartedModule
122122{
123- use
124- BrowserAssertionsTrait,
125- ConsoleAssertionsTrait,
126- DoctrineAssertionsTrait,
127- EventsAssertionsTrait,
128- FormAssertionsTrait,
129- MailerAssertionsTrait,
130- ParameterAssertionsTrait,
131- RouterAssertionsTrait,
132- SecurityAssertionsTrait,
133- ServicesAssertionsTrait,
134- SessionAssertionsTrait,
135- TwigAssertionsTrait
136- ;
123+ use BrowserAssertionsTrait;
124+ use ConsoleAssertionsTrait;
125+ use DoctrineAssertionsTrait;
126+ use EventsAssertionsTrait;
127+ use FormAssertionsTrait;
128+ use MailerAssertionsTrait;
129+ use ParameterAssertionsTrait;
130+ use RouterAssertionsTrait;
131+ use SecurityAssertionsTrait;
132+ use ServicesAssertionsTrait;
133+ use SessionAssertionsTrait;
134+ use TwigAssertionsTrait;
137135
138136 /**
139137 * @var Kernel
@@ -219,7 +217,7 @@ public function _after(TestInterface $test): void
219217 parent ::_after ($ test );
220218 }
221219
222- protected function onReconfigure ($ settings = []): void
220+ protected function onReconfigure (array $ settings = []): void
223221 {
224222 parent ::_beforeSuite ($ settings );
225223 $ this ->_initialize ();
@@ -235,9 +233,10 @@ public function _getEntityManager()
235233 if ($ this ->kernel === null ) {
236234 $ this ->fail ('Symfony module is not loaded ' );
237235 }
238- if (!isset ($ this ->permanentServices [$ this ->config ['em_service ' ]])) {
239- // try to persist configured EM
240- $ this ->persistPermanentService ($ this ->config ['em_service ' ]);
236+ $ emService = $ this ->config ['em_service ' ];
237+ if (!isset ($ this ->permanentServices [$ emService ])) {
238+ // Try to persist configured entity manager
239+ $ this ->persistPermanentService ($ emService );
241240 $ container = $ this ->_getContainer ();
242241 if ($ container ->has ('doctrine ' )) {
243242 $ this ->persistPermanentService ('doctrine ' );
@@ -249,7 +248,7 @@ public function _getEntityManager()
249248 $ this ->persistPermanentService ('doctrine.dbal.backend_connection ' );
250249 }
251250 }
252- return $ this ->permanentServices [$ this -> config [ ' em_service ' ] ];
251+ return $ this ->permanentServices [$ emService ];
253252 }
254253
255254 /**
@@ -277,19 +276,18 @@ protected function getTestContainer(): ?object
277276
278277 /**
279278 * Attempts to guess the kernel location.
280- *
281279 * When the Kernel is located, the file is required.
282280 *
283281 * @return string The Kernel class name
284- * @throws ModuleRequireException|ReflectionException|ModuleException
282+ * @throws ModuleRequireException|ReflectionException
285283 */
286284 protected function getKernelClass (): string
287285 {
288286 $ path = codecept_root_dir () . $ this ->config ['app_path ' ];
289- if (!file_exists (codecept_root_dir () . $ this -> config [ ' app_path ' ] )) {
287+ if (!file_exists ($ path )) {
290288 throw new ModuleRequireException (
291289 self ::class,
292- "Can't load Kernel from $ path. \n"
290+ "Can't load Kernel from { $ path} . \n"
293291 . 'Directory does not exists. Use `app_path` parameter to provide valid application path '
294292 );
295293 }
@@ -300,15 +298,12 @@ protected function getKernelClass(): string
300298 if ($ results === []) {
301299 throw new ModuleRequireException (
302300 self ::class,
303- "File with Kernel class was not found at $ path. "
301+ "File with Kernel class was not found at { $ path} . \n "
304302 . 'Specify directory where file with Kernel class for your application is located with `app_path` parameter. '
305303 );
306304 }
307305
308- if (file_exists (codecept_root_dir () . 'vendor ' . DIRECTORY_SEPARATOR . 'autoload.php ' )) {
309- // ensure autoloader from this dir is loaded
310- require_once codecept_root_dir () . 'vendor ' . DIRECTORY_SEPARATOR . 'autoload.php ' ;
311- }
306+ $ this ->requireAdditionalAutoloader ();
312307
313308 $ filesRealPath = array_map (function ($ file ) {
314309 require_once $ file ;
@@ -333,9 +328,6 @@ protected function getKernelClass(): string
333328 );
334329 }
335330
336- /**
337- * @return Profile|null
338- */
339331 protected function getProfile (): ?Profile
340332 {
341333 /** @var Profiler $profiler */
@@ -451,4 +443,16 @@ protected function getInternalDomains(): array
451443
452444 return array_unique ($ internalDomains );
453445 }
446+
447+ /**
448+ * Ensures autoloader loading of additional directories.
449+ * It is only required for CI jobs to run correctly.
450+ */
451+ private function requireAdditionalAutoloader (): void
452+ {
453+ $ autoLoader = codecept_root_dir () . 'vendor ' . DIRECTORY_SEPARATOR . 'autoload.php ' ;
454+ if (file_exists ($ autoLoader )) {
455+ require_once $ autoLoader ;
456+ }
457+ }
454458}
0 commit comments