@@ -134,20 +134,8 @@ public function _parts()
134134
135135 public function _initialize ()
136136 {
137- $ cache = Configuration::projectDir () . $ this ->config ['var_path ' ] . DIRECTORY_SEPARATOR . 'bootstrap.php.cache ' ;
138- if (!file_exists ($ cache )) {
139- throw new ModuleRequireException (
140- __CLASS__ ,
141- "Symfony bootstrap file not found in $ cache \n \n" .
142- "Please specify path to bootstrap file using `var_path` config option \n \n" .
143- "If you are trying to load bootstrap from a Bundle provide path like: \n \n" .
144- "modules: \n enabled: \n" .
145- " - Symfony: \n" .
146- " var_path: '../../app' \n" .
147- " app_path: '../../app' "
148- );
149- }
150- require_once $ cache ;
137+
138+ $ this ->initializeSymfonyCache ();
151139 $ this ->kernelClass = $ this ->getKernelClass ();
152140 $ maxNestingLevel = 200 ; // Symfony may have very long nesting level
153141 $ xdebugMaxLevelKey = 'xdebug.max_nesting_level ' ;
@@ -163,6 +151,31 @@ public function _initialize()
163151 }
164152 }
165153
154+ /**
155+ * Require Symfonys bootstrap.php.cache only for PHP Version < 7
156+ *
157+ * @throws ModuleRequireException
158+ */
159+ private function initializeSymfonyCache ()
160+ {
161+ $ cache = Configuration::projectDir () . $ this ->config ['var_path ' ] . DIRECTORY_SEPARATOR . 'bootstrap.php.cache ' ;
162+ if (PHP_VERSION_ID < 70000 && !file_exists ($ cache )) {
163+ throw new ModuleRequireException (
164+ __CLASS__ ,
165+ "Symfony bootstrap file not found in $ cache \n \n" .
166+ "Please specify path to bootstrap file using `var_path` config option \n \n" .
167+ "If you are trying to load bootstrap from a Bundle provide path like: \n \n" .
168+ "modules: \n enabled: \n" .
169+ " - Symfony: \n" .
170+ " var_path: '../../app' \n" .
171+ " app_path: '../../app' "
172+ );
173+ }
174+ if (file_exists ($ cache )) {
175+ require_once $ cache ;
176+ }
177+ }
178+
166179 /**
167180 * Initialize new client instance before each test
168181 */
0 commit comments