c3
c3 copied to clipboard
Constant C3_CODECOVERAGE_MEDIATE_STORAGE can be used before it's defined
If these lines fail:
try {
\Codeception\Configuration::config($config_file);
} catch (\Exception $e) {
__c3_error($e->getMessage());
}
due to \Codeception\Configuration not existing, then
$errorLogFile = defined('C3_CODECOVERAGE_ERROR_LOG_FILE') ?
C3_CODECOVERAGE_ERROR_LOG_FILE :
C3_CODECOVERAGE_MEDIATE_STORAGE . DIRECTORY_SEPARATOR . 'error.txt';
is called before
define('C3_CODECOVERAGE_MEDIATE_STORAGE', Codeception\Configuration::logDir() . 'c3tmp');
define('C3_CODECOVERAGE_PROJECT_ROOT', Codeception\Configuration::projectDir());
define('C3_CODECOVERAGE_TESTNAME', $_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE']);
is run.
This like a true...
https://github.com/Codeception/c3/blob/777e3b626d9a5ecdfea3eff3d3de437045b41c92/c3.php#L33-L49 is a function definition.
In this code https://github.com/Codeception/c3/blob/777e3b626d9a5ecdfea3eff3d3de437045b41c92/c3.php#L95-L99
Function __c3_error is called before check
https://github.com/Codeception/c3/blob/777e3b626d9a5ecdfea3eff3d3de437045b41c92/c3.php#L101
This is still an issue, I am using Laravel so I have made the following change:
$mediateStorage = defined('C3_CODECOVERAGE_MEDIATE_STORAGE') ?
C3_CODECOVERAGE_MEDIATE_STORAGE :
'storage';
$errorLogFile = defined('C3_CODECOVERAGE_ERROR_LOG_FILE') ?
C3_CODECOVERAGE_ERROR_LOG_FILE :
$mediateStorage . DIRECTORY_SEPARATOR . 'error.txt';