8000 Make symfony bootstrap.php.cache optional for php version > 7 by patrickjahns · Pull Request #4081 · Codeception/Codeception · GitHub
[go: up one dir, main page]

Skip to content

Make symfony bootstrap.php.cache optional for php version > 7 #4081

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 27 additions & 14 deletions src/Codeception/Module/Symfony.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,8 @@ public function _parts()

public function _initialize()
{
$cache = Configuration::projectDir() . $this->config['var_path'] . DIRECTORY_SEPARATOR . 'bootstrap.php.cache';
if (!file_exists($cache)) {
throw new ModuleRequireException(
__CLASS__,
"Symfony bootstrap file not found in $cache\n \n" .
"Please specify path to bootstrap file using `var_path` config option\n \n" .
"If you are trying to load bootstrap from a Bundle provide path like:\n \n" .
"modules:\n enabled:\n" .
" - Symfony:\n" .
" var_path: '../../app'\n" .
" app_path: '../../app'"
);
}
require_once $cache;

$this->initializeSymfonyCache();
$this->kernelClass = $this->getKernelClass();
$maxNestingLevel = 200; // Symfony may have very long nesting level
$xdebugMaxLevelKey = 'xdebug.max_nesting_level';
Expand All @@ -163,6 +151,31 @@ public function _initialize()
}
}

/**
* Require Symfonys bootstrap.php.cache only for PHP Version < 7
*
* @throws ModuleRequireException
*/
private function initializeSymfonyCache()
{
$cache = Configuration::projectDir() . $this->config['var_path'] . DIRECTORY_SEPARATOR . 'bootstrap.php.cache';
if (PHP_VERSION_ID < 70000 && !file_exists($cache)) {
throw new ModuleRequireException(
__CLASS__,
"Symfony bootstrap file not found in $cache\n \n" .
"Please specify path to bootstrap file using `var_path` config option\n \n" .
"If you are trying to load bootstrap from a Bundle provide path like:\n \n" .
"modules:\n enabled:\n" .
" - Symfony:\n" .
" var_path: '../../app'\n" .
" app_path: '../../app'"
);
}
if (file_exists($cache)) {
require_once $cache;
}
}

/**
* Initialize new client instance before each test
*/
Expand Down
0