Completed
Pull Request — master (#11)
by Spencer
01:59
created

build.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
#!/usr/bin/env php
2
<?php
3
require 'vendor/autoload.php';
4
5
$phpcsCLI = new PHP_CodeSniffer_CLI();
6
$phpcsViolations = $phpcsCLI->process(['standard' => ['PSR1'], 'files' => ['src', 'tests', 'build.php']]);
7
if ($phpcsViolations > 0) {
8
    exit(1);
9
}
10
11
$phpunitConfiguration = PHPUnit_Util_Configuration::getInstance(__DIR__ . '/phpunit.xml');
12
$phpunitArguments = ['coverageHtml' => __DIR__ . '/coverage', 'configuration' => $phpunitConfiguration];
13
$testRunner = new PHPUnit_TextUI_TestRunner();
14
$result = $testRunner->doRun($phpunitConfiguration->getTestSuiteConfiguration(), $phpunitArguments);
0 ignored issues
show
The call to doRun() misses a required argument $exit.

This check looks for function calls that miss required arguments.

Loading history...
15
if (!$result->wasSuccessful()) {
16
    exit(1);
17
}
18
19
$coverageFactory = new PHP_CodeCoverage_Report_Factory();
20
$coverageReport = $coverageFactory->create($result->getCodeCoverage());
21
if ($coverageReport->getNumExecutedLines() !== $coverageReport->getNumExecutableLines()) {
22
    file_put_contents('php://stderr', "Code coverage was NOT 100%\n");
23
    exit(1);
24
}
25
26
file_put_contents('php://stderr', "Code coverage was 100%\n");
27