File tree Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Original file line number Diff line number Diff line change 9
9
use Codeception \Lib \Interfaces \PartedModule ;
10
10
use Symfony \Component \Finder \Finder ;
11
11
use Symfony \Component \DependencyInjection \ContainerInterface ;
12
+ use Symfony \Component \Finder \SplFileInfo ;
12
13
use Symfony \Component \VarDumper \Cloner \Data ;
13
14
14
15
/**
@@ -257,17 +258,32 @@ protected function getKernelClass()
257
258
if (!count ($ results )) {
258
259
throw new ModuleRequireException (
259
260
__CLASS__ ,
260
- "AppKernel was not found at $ path. "
261
- . "Specify directory where Kernel class for your application is located with `app_path` parameter. "
261
+ "File with Kernel class was not found at $ path. "
262
+ . "Specify directory where file with Kernel class for your application is located with `app_path` parameter. "
262
263
);
263
264
}
264
-
265
265
$ file = current ($ results );
266
- $ class = $ file ->getBasename ('.php ' );
267
266
268
267
require_once $ file ;
269
268
270
- return $ class ;
269
+ $ possibleKernelClasses = [
270
+ 'AppKernel ' , // Symfony Standard
271
+ 'App\Kernel ' , // Symfony Flex
272
+ ];
273
+ foreach ($ possibleKernelClasses as $ class ) {
274
+ if (class_exists ($ class )) {
275
+ $ refClass = new \ReflectionClass ($ class );
276
+ if ($ refClass ->getFileName () === $ file ->getRealpath ()) {
277
+ return $ class ;
278
+ }
279
+ }
280
+ }
281
+
282
+ throw new ModuleRequireException (
283
+ __CLASS__ ,
284
+ "Kernel class was not found in $ file. "
285
+ . "Specify directory where file with Kernel class for your application is located with `app_path` parameter. "
286
+ );
271
287
}
272
288
273
289
/**
You can’t perform that action at this time.
0 commit comments