PHP Classes

File: system/dependencies/kahlan/kahlan/kahlan-config.travis.php

Recommend this page to a friend!
  Classes of Dimitri Sitchet   dFramework   system/dependencies/kahlan/kahlan/kahlan-config.travis.php   Download  
File: system/dependencies/kahlan/kahlan/kahlan-config.travis.php
Role: Example script
Content type: text/plain
Description: Example script
Class: dFramework
Framework to build PHP applications
Author: By
Last change:
Date: 2 years ago
Size: 2,348 bytes
 

Contents

Class file image Download
<?php
use Kahlan\Filter\Filters;
use
Kahlan\Reporter\Coverage;
use
Kahlan\Reporter\Coverage\Driver\Xdebug;
use
Kahlan\Reporter\Coverage\Exporter\Coveralls;
use
Kahlan\Reporter\Coverage\Exporter\CodeClimate;

$commandLine = $this->commandLine();
$commandLine->option('coverage', 'default', 3);

Filters::apply($this, 'coverage', function($next) {
    if (!
extension_loaded('xdebug')) {
        return;
    }
   
$reporters = $this->reporters();
   
$coverage = new Coverage([
       
'verbosity' => $this->commandLine()->get('coverage'),
       
'driver' => new Xdebug(),
       
'path' => $this->commandLine()->get('src'),
       
'exclude' => [
           
//Exclude init script
           
'src/init.php',
           
'src/functions.php',
           
//Exclude Workflow from code coverage reporting
           
'src/Cli/Kahlan.php',
           
//Exclude coverage classes from code coverage reporting (don't know how to test the tester)
           
'src/Reporter/Coverage/Collector.php',
           
'src/Reporter/Coverage/Driver/Xdebug.php',
           
'src/Reporter/Coverage/Driver/HHVM.php',
           
'src/Reporter/Coverage/Driver/Phpdbg.php',
           
//Exclude text based reporter classes from code coverage reporting (a bit useless)
           
'src/Reporter/Dot.php',
           
'src/Reporter/Bar.php',
           
'src/Reporter/Verbose.php',
           
'src/Reporter/Terminal.php',
           
'src/Reporter/Reporter.php',
           
'src/Reporter/Coverage.php',
           
'src/Reporter/Json.php',
           
'src/Reporter/Tap.php',
        ],
       
'colors' => !$this->commandLine()->get('no-colors')
    ]);
   
$reporters->add('coverage', $coverage);
});

Filters::apply($this, 'reporting', function($next) {
   
$reporter = $this->reporters()->get('coverage');
    if (!
$reporter) {
        return;
    }
   
Coveralls::write([
       
'collector' => $reporter,
       
'file' => 'coveralls.json',
       
'service_name' => 'travis-ci',
       
'service_job_id' => getenv('TRAVIS_JOB_ID') ?: null
   
]);
   
CodeClimate::write([
       
'collector' => $reporter,
       
'file' => 'codeclimate.json',
       
'branch' => getenv('TRAVIS_BRANCH') ?: null,
       
'repo_token' => '422174e17459424c0dc0dfdd720eb17324b283a204b093e85ba21400f1414536'
   
]);
    return
$next();
});