Skip to content

Commit

Permalink
Merge pull request #4692 from MGatner/ci-test
Browse files Browse the repository at this point in the history
Allow CI Environments
  • Loading branch information
MGatner authored May 16, 2021
2 parents 1d9d1b5 + 34fd572 commit 8de5275
Showing 1 changed file with 4 additions and 13 deletions.
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

0 comments on commit 8de5275

Please sign in to comment.