File tree Expand file tree Collapse file tree 1 file changed +20
-18
lines changed
Expand file tree Collapse file tree 1 file changed +20
-18
lines changed Original file line number Diff line number Diff line change 2626
2727$ xml = new \SimpleXMLElement (file_get_contents ($ phpUnitFile ));
2828
29- $ envDir = $ xml ->xpath ("//php/server[@name='KERNEL_DIR'] " );
30- if (!count ($ envDir )) {
31- throw new \Exception (
32- 'Kernel path must be set via <server name"KERNEL_DIR" value="..."/> '
33- );
34- }
3529$ envClass = $ xml ->xpath ("//php/env[@name='KERNEL_CLASS'] " );
36-
37- $ kernelClass = count ($ envClass ) ? (string ) $ envClass [0 ]['value ' ] : 'AppKernel ' ;
38- $ kernelNs = explode ('\\' , $ kernelClass );
39- $ kernelFile = $ rootDir .'/ ' .$ envDir [0 ]['value ' ].'/ ' .array_pop ($ kernelNs ).'.php ' ;
40-
41- if (!file_exists ($ kernelFile )) {
42- throw new \Exception (sprintf (
43- 'Cannot find kernel file "%s" ' ,
44- $ kernelFile
45- ));
30+ if (count ($ envClass )) {
31+ $ kernelClass = (string ) $ envClass [0 ]['value ' ];
32+ } else {
33+ $ envDir = $ xml ->xpath ("//php/server[@name='KERNEL_DIR'] " );
34+ if (!count ($ envDir )) {
35+ throw new \Exception (
36+ 'KERNEL_CLASS must be set via <env name"KERNEL_CLASS" value="..."/> '
37+ );
38+ }
39+ $ kernelClass = 'AppKernel ' ;
40+ $ kernelFile = $ rootDir .'/ ' .$ envDir [0 ]['value ' ].'/ ' .$ kernelClass .'.php ' ;
41+
42+ if (!file_exists ($ kernelFile )) {
43+ throw new \Exception (sprintf (
44+ 'Cannot find kernel file "%s" ' ,
45+ $ kernelFile
46+ ));
47+ }
48+
49+ require_once $ kernelFile ;
4650}
4751
48- require_once $ kernelFile ;
49-
5052return new $ kernelClass ($ env , true );
You can’t perform that action at this time.
0 commit comments