PHP code example of holyshared / coverallskit

1. Go to this page and download the library: Download holyshared/coverallskit library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

holyshared / coverallskit example snippets


$travis = new TravisCI( new Environment($_SERVER) );
$service = new CIService($travis);

$builder = new CoverallsReportBuilder();
$builder->token('your repository token')
	->service($service)
	->repository(new GitRepository(__DIR__ . '/../'));

$source = new SourceFile('path/to/file');
$source->addCoverage(CoverageResult::executed(1));	//The first line was executed
$source->addCoverage(CoverageResult::unused(2));	//The second line is not executed
$source->addCoverage(CoverageResult::executed(3));	//The third line is executed

$builder->addSource($source);
$builder->build()->saveAs(__DIR__ . '/tmp/coverage.json');

use coverallskit\BuilderConfiguration;
use coverallskit\CoverallsReportBuilder;

$configuration = BuilderConfiguration::loadFromFile('coveralls.toml');
$builder = CoverallsReportBuilder::fromConfiguration($configuration);
$builder->build()->save()->upload();