1

enter image description here

if (!function_exists('birthday_to_age')) {

/**
 * calculate the age of input date
 * @param Carbon $date input date
 * @return int the age
 */
function birthday_to_age(Carbon $date): int
{
    return floor((date('Ymd') - $date->format('Ymd')) / 10000);
}

}

if (!function_exists('log_http_client_response')) {

/**
 * Function log_http_client_response
 * @param Response $response
 * @param string $prefix
 * @param string $level
 */
function log_http_client_response(Response $response, string $prefix = '', string $level = 'debug')
{
    $content = $prefix . "Response http_status: {$response->status()}, http_headers: "
        . json_encode($response->headers()) . ", http_body: {$response->body()}";
    Log::$level($content);
}

}

The coverage report showed two lines of "if (!function_exists('function_name'))" were not been covered, but these two functions within "if" was covered. It's ridiculous because when I used xdebug to be as the driver, these two lines were covered, but when I changed the driver to pcov without any other changes, the problem occurred.

Did any one meet this problem? does any one know how to cover these two lines?

Thanks

Tony Tao
  • 31
  • 1

0 Answers0