PHP Classes

File: coverage-check

Recommend this page to a friend!
  Classes of Eric Sizemore   PHPUnit Coverage Report Check   coverage-check   Download  
File: coverage-check
Role: Example script
Content type: text/plain
Description: Example script
Class: PHPUnit Coverage Report Check
Check code coverage using the clover xml report.
Author: By
Last change: Removing phpstan-symfony, other small changes
cs fixes, small optimizations
working on 2.0
Date: 7 months ago
Size: 1,568 bytes
 

Contents

Class file image Download
#!/usr/bin/env php
<?php

declare(strict_types=1);

/**
 * This file is part of PHPUnit Coverage Check.
 *
 * (c) Eric Sizemore <admin@secondversion.com>
 * (c) Richard Regeer <rich2309@gmail.com>
 *
 * This source file is subject to the MIT license. For the full copyright,
 * license information, and credits/acknowledgements, please view the LICENSE
 * and README files that were distributed with this source code.
 */
// Attempt to load dependencies
(static function () {
   
$possibleLocations = [
       
__DIR__ . '/../../autoload.php',
       
__DIR__ . '/../autoload.php',
       
__DIR__ . '/vendor/autoload.php',
    ];

   
$loader = null;

    foreach (
$possibleLocations as $possibleLocation) {
        if (
file_exists($possibleLocation)) {
           
$loader = $possibleLocation;

            break;
        }
    }

    if (
$loader === null) {
        throw new
RuntimeException(sprintf(
           
'You must set up the project dependencies, run the following commands:%1$s' .
           
'curl -sS https://getcomposer.org/installer | php%1$s' .
           
'php composer.phar install%1$s',
            \
PHP_EOL
       
));
    }

    require_once
$loader;
})();

// Setup application
use Esi\CoverageCheck\Application;
use
Esi\CoverageCheck\Command\CoverageCheckCommand;
use
Esi\CoverageCheck\CoverageCheck;

$command = new CoverageCheckCommand(new CoverageCheck());
$commandName = $command->getName() ?? 'coverage:check';

$console = new Application();
$console->add($command);
$console->setDefaultCommand($commandName, true);
$console->run();