Skip to content

Commit c32b735

Browse files
authored
Merge pull request #2820 from samsonasik/ignore-coverage-exit
ignore coverage on exit and die
2 parents 47c17e9 + 70e7ed8 commit c32b735

5 files changed

Lines changed: 16 additions & 1 deletion

File tree

system/CodeIgniter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,11 @@ protected function bootstrapEnvironment()
498498
}
499499
else
500500
{
501+
// @codeCoverageIgnoreStart
501502
header('HTTP/1.1 503 Service Unavailable.', true, 503);
502503
echo 'The application environment is not set correctly.';
503504
exit(1); // EXIT_ERROR
505+
// @codeCoverageIgnoreEnd
504506
}
505507
}
506508

@@ -1114,7 +1116,9 @@ protected function sendResponse()
11141116
*/
11151117
protected function callExit($code)
11161118
{
1119+
// @codeCoverageIgnoreStart
11171120
exit($code);
1121+
// @codeCoverageIgnoreEnd
11181122
}
11191123

11201124
//--------------------------------------------------------------------

system/Commands/Server/Serve.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,10 @@ public function run(array $params)
131131
// Valid PHP Version?
132132
if (phpversion() < $this->minPHPVersion)
133133
{
134+
// @codeCoverageIgnoreStart
134135
die('Your PHP version must be ' . $this->minPHPVersion .
135136
' or higher to run CodeIgniter. Current version: ' . phpversion());
137+
// @codeCoverageIgnoreEnd
136138
}
137139

138140
// Collect any user-supplied options and apply them.

system/Common.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,11 @@ function db_connect($db = null, bool $getShared = true)
246246
*/
247247
function dd(...$vars)
248248
{
249+
// @codeCoverageIgnoreStart
249250
Kint::$aliases[] = 'dd';
250251
Kint::dump(...$vars);
251252
exit;
253+
// @codeCoverageIgnoreEnd
252254
}
253255
}
254256

@@ -404,7 +406,7 @@ function force_https(int $duration = 31536000, RequestInterface $request = null,
404406
{
405407
return;
406408
}
407-
409+
// @codeCoverageIgnoreStart
408410
// If the session library is loaded, we should regenerate
409411
// the session ID for safety sake.
410412
if (class_exists('Session', false))
@@ -431,6 +433,7 @@ function force_https(int $duration = 31536000, RequestInterface $request = null,
431433
$response->sendHeaders();
432434

433435
exit();
436+
// @codeCoverageIgnoreEnd
434437
}
435438
}
436439

system/ComposerScripts.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ protected static function moveFile(string $source, string $destination): bool
9090

9191
if (empty($source))
9292
{
93+
// @codeCoverageIgnoreStart
9394
die('Cannot move file. Source path invalid.');
95+
// @codeCoverageIgnoreEnd
9496
}
9597

9698
if (! is_file($source))
@@ -203,7 +205,9 @@ public static function moveEscaper()
203205
{
204206
if (! static::moveFile($source, $dest))
205207
{
208+
// @codeCoverageIgnoreStart
206209
die('Error moving: ' . $source);
210+
// @codeCoverageIgnoreEnd
207211
}
208212
}
209213
}

system/Debug/Exceptions.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ public function initialize()
142142
*/
143143
public function exceptionHandler(Throwable $exception)
144144
{
145+
// @codeCoverageIgnoreStart
145146
$codes = $this->determineCodes($exception);
146147
$statusCode = $codes[0];
147148
$exitCode = $codes[1];
@@ -171,6 +172,7 @@ public function exceptionHandler(Throwable $exception)
171172
$this->render($exception, $statusCode);
172173

173174
exit($exitCode);
175+
// @codeCoverageIgnoreEnd
174176
}
175177

176178
//--------------------------------------------------------------------

0 commit comments

Comments
 (0)