Fix #18477: Fix detecting availability of Xdebug's stack trace in yii\base\ErrorException

This commit is contained in:
Bizley
2021-01-13 14:13:41 +01:00
committed by GitHub
parent 0781b02cc3
commit 95bf26a3ba
3 changed files with 50 additions and 8 deletions

View File

@ -15,10 +15,25 @@ use yiiunit\TestCase;
*/
class ErrorExceptionTest extends TestCase
{
public function testXdebugTrace()
private function isXdebugStackAvailable()
{
if (!function_exists('xdebug_get_function_stack')) {
$this->markTestSkipped('Xdebug are required.');
return false;
}
$version = phpversion('xdebug');
if ($version === false) {
return false;
}
if (version_compare($version, '3.0.0', '<')) {
return true;
}
return false !== strpos(ini_get('xdebug.mode'), 'develop');
}
public function testXdebugTrace()
{
if (!$this->isXdebugStackAvailable()) {
$this->markTestSkipped('Xdebug is required.');
}
try {
throw new ErrorException();