Skip to content

Commit 34fd572

Browse files
committed
Allow non-testing CI
1 parent 1d9d1b5 commit 34fd572

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

system/CodeIgniter.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,13 @@ public function __construct(App $config)
152152
{
153153
if (version_compare(PHP_VERSION, self::MIN_PHP_VERSION, '<'))
154154
{
155+
// @codeCoverageIgnoreStart
155156
$message = extension_loaded('intl')
156157
? lang('Core.invalidPhpVersion', [self::MIN_PHP_VERSION, PHP_VERSION])
157158
: sprintf('Your PHP version must be %s or higher to run CodeIgniter. Current version: %s', self::MIN_PHP_VERSION, PHP_VERSION);
158159

159160
exit($message);
161+
// @codeCoverageIgnoreEnd
160162
}
161163

162164
$this->startTime = microtime(true);
@@ -505,18 +507,7 @@ protected function handleRequest(?RouteCollectionInterface $routes, Cache $cache
505507
protected function detectEnvironment()
506508
{
507509
// Make sure ENVIRONMENT isn't already set by other means.
508-
if (! defined('ENVIRONMENT'))
509-
{
510-
// running under Continuous Integration server?
511-
if (getenv('CI') !== false)
512-
{
513-
define('ENVIRONMENT', 'testing');
514-
}
515-
else
516-
{
517-
define('ENVIRONMENT', $_SERVER['CI_ENVIRONMENT'] ?? 'production');
518-
}
519-
}
510+
defined('ENVIRONMENT') || define('ENVIRONMENT', $_SERVER['CI_ENVIRONMENT'] ?? 'production'); // @codeCoverageIgnore
520511
}
521512

522513
//--------------------------------------------------------------------
@@ -998,7 +989,7 @@ protected function display404errors(PageNotFoundException $e)
998989
// When testing, one is for phpunit, another is for test case.
999990
elseif (ob_get_level() > 2)
1000991
{
1001-
ob_end_flush();
992+
ob_end_flush(); // @codeCoverageIgnore
1002993
}
1003994

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

0 commit comments

Comments
 (0)