Skip to content
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

Allow CI Environments #4692

Merged
merged 1 commit into from
May 16, 2021
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
17 changes: 4 additions & 13 deletions system/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,13 @@ public function __construct(App $config)
{
if (version_compare(PHP_VERSION, self::MIN_PHP_VERSION, '<'))
{
// @codeCoverageIgnoreStart
$message = extension_loaded('intl')
? lang('Core.invalidPhpVersion', [self::MIN_PHP_VERSION, PHP_VERSION])
: sprintf('Your PHP version must be %s or higher to run CodeIgniter. Current version: %s', self::MIN_PHP_VERSION, PHP_VERSION);

exit($message);
// @codeCoverageIgnoreEnd
}

$this->startTime = microtime(true);
Expand Down Expand Up @@ -505,18 +507,7 @@ protected function handleRequest(?RouteCollectionInterface $routes, Cache $cache
protected function detectEnvironment()
{
// Make sure ENVIRONMENT isn't already set by other means.
if (! defined('ENVIRONMENT'))
{
// running under Continuous Integration server?
if (getenv('CI') !== false)
{
define('ENVIRONMENT', 'testing');
}
else
{
define('ENVIRONMENT', $_SERVER['CI_ENVIRONMENT'] ?? 'production');
}
}
defined('ENVIRONMENT') || define('ENVIRONMENT', $_SERVER['CI_ENVIRONMENT'] ?? 'production'); // @codeCoverageIgnore
}

//--------------------------------------------------------------------
Expand Down Expand Up @@ -998,7 +989,7 @@ protected function display404errors(PageNotFoundException $e)
// When testing, one is for phpunit, another is for test case.
elseif (ob_get_level() > 2)
{
ob_end_flush();
ob_end_flush(); // @codeCoverageIgnore
}

throw PageNotFoundException::forPageNotFound(ENVIRONMENT !== 'production' || is_cli() ? $e->getMessage() : '');
Expand Down