Skip to content

Commit

Permalink
Fixes coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis committed Nov 3, 2021
1 parent 4d6cce6 commit 9721bde
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/Helper.php
Expand Up @@ -45,7 +45,7 @@ public static function executeReal(
$rootPath = __DIR__ . '/fake-app';
$args['no-ansi'] = null;

return Cli::exec("{$prefix} php {$rootPath}/bin.php {$command}", $args, $rootPath);
return Cli::exec("{$prefix} php {$rootPath}/cli-wrapper.php {$command}", $args, $rootPath);
}

/**
Expand Down
44 changes: 44 additions & 0 deletions tests/fake-app/cli-wrapper.php
@@ -0,0 +1,44 @@
<?php

/**
* JBZoo Toolbox - Cli
*
* This file is part of the JBZoo Toolbox project.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @package Cli
* @license MIT
* @copyright Copyright (C) JBZoo.com, All rights reserved.
* @link https://github.com/JBZoo/Cli
*/

declare(strict_types=1);

use JBZoo\PHPUnit\CovCatcher;
use JBZoo\Utils\Sys;

define('PROJECT_ROOT', dirname(__DIR__, 2));

require_once PROJECT_ROOT . '/vendor/autoload.php';

$cliIndexFile = PROJECT_ROOT . '/tests/fake-app/bin.php';

define('IS_PHPUNIT_TEST', true);

if (class_exists(CovCatcher::class) && Sys::hasXdebug()) {
$covCatcher = new CovCatcher(uniqid('prefix-', true), [
'html' => 0,
'xml' => 1,
'cov' => 1,
'src' => PROJECT_ROOT . '/src',
'build_xml' => PROJECT_ROOT . '/build/coverage_xml',
'build_cov' => PROJECT_ROOT . '/build/coverage_cov',
]);

$result = $covCatcher->includeFile($cliIndexFile);
} else {
$result = require_once $cliIndexFile;
}

return $result;

0 comments on commit 9721bde

Please sign in to comment.