oreolek
/
news-script
Archived
1
0
Fork 0

phpunit config

This commit is contained in:
Alexander Yakovlev 2019-04-16 13:54:47 +07:00
parent ef7cde242e
commit 50e0544fc7
Signed by: oreolek
GPG Key ID: 1CDC4B7820C93BD3
2 changed files with 20 additions and 4 deletions

14
phpunit.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true">
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./Source/</directory>
<directory suffix=".php">./</directory>
</whitelist>
</filter>
<testsuites>
<testsuite name="Application Test Suite">
<directory>tests/</directory>
</testsuite>
</testsuites>
</phpunit>

10
run.php
View File

@ -33,14 +33,16 @@ $parsers = 'all';
if (PHP_SAPI !== 'cli') { if (PHP_SAPI !== 'cli') {
ob_start(); ob_start();
echo '<!DOCTYPE html><html><body><code><pre>'; echo '<!DOCTYPE html><html><body><code><pre>';
$parsers = $_GET['parsers'] ?? 'all'; if (isset($_GET) && isset($_GET['parsers'])) {
$parsers = explode(',', $parsers); $parsers = $_GET['parsers'];
$parsers = explode(',', $parsers);
}
} else { } else {
if (isset($argv[1])) { if (isset($argv[1])) {
$parsers = explode(',', strtolower($argv[1])); $parsers = explode(',', strtolower($argv[1]));
} }
} }
if ($parsers === 'all' || in_array('all', $parsers)) { if ($parsers === 'all') {
$parsers = [ $parsers = [
'urq', 'urq',
'anivisual', 'anivisual',
@ -63,7 +65,7 @@ if ($parsers === 'all' || in_array('all', $parsers)) {
function check($classname, $command) { function check($classname, $command) {
global $parsers; global $parsers;
if (in_array($command, $parsers)) { if (is_array($parsers) && in_array($command, $parsers)) {
$cname = 'Source\\'.$classname; $cname = 'Source\\'.$classname;
(new $cname())->check(); (new $cname())->check();
} }