J. King
6 years ago
15 changed files with 3874 additions and 4 deletions
@ -0,0 +1,29 @@ |
|||
<?php |
|||
/** @license MIT |
|||
* Copyright 2018 J. King et al. |
|||
* See LICENSE and AUTHORS files for details */ |
|||
|
|||
namespace MensBeam\UTF8; |
|||
|
|||
const BASE = __DIR__.DIRECTORY_SEPARATOR; |
|||
|
|||
$paths = [ |
|||
__FILE__, |
|||
BASE."RoboFile.php", |
|||
BASE."lib", |
|||
BASE."tests", |
|||
]; |
|||
$rules = [ |
|||
'@PSR2' => true, |
|||
'braces' => ['position_after_functions_and_oop_constructs' => "same"], |
|||
]; |
|||
|
|||
$finder = \PhpCsFixer\Finder::create(); |
|||
foreach ($paths as $path) { |
|||
if (is_file($path)) { |
|||
$finder = $finder->append([$path]); |
|||
} else { |
|||
$finder = $finder->in($path); |
|||
} |
|||
} |
|||
return \PhpCsFixer\Config::create()->setRules($rules)->setFinder($finder); |
@ -0,0 +1,76 @@ |
|||
<?php |
|||
|
|||
use Robo\Result; |
|||
|
|||
/** |
|||
* This is project's console commands configuration for Robo task runner. |
|||
* |
|||
* @see http://robo.li/ |
|||
*/ |
|||
class RoboFile extends \Robo\Tasks { |
|||
const BASE = __DIR__.\DIRECTORY_SEPARATOR; |
|||
const BASE_TEST = self::BASE."tests".\DIRECTORY_SEPARATOR; |
|||
|
|||
/** |
|||
* Runs the full test suite |
|||
* |
|||
* Arguments passed to the task are passed on to PHPUnit. Thus one may, for |
|||
* example, run the following command and get the expected results: |
|||
* |
|||
* ./robo test --testsuite TTRSS --exclude-group slow --testdox |
|||
* |
|||
* Please see the PHPUnit documentation for available options. |
|||
*/ |
|||
public function test(array $args): Result { |
|||
$execpath = realpath(self::BASE."vendor-bin/phpunit/vendor/phpunit/phpunit/phpunit"); |
|||
$confpath = realpath(self::BASE_TEST."phpunit.xml"); |
|||
return $this->taskExec("php")->arg($execpath)->option("-c", $confpath)->args($args)->run(); |
|||
} |
|||
|
|||
/** |
|||
* Runs the full test suite |
|||
* |
|||
* This is an alias of the "test" task. |
|||
*/ |
|||
public function testFull(array $args): Result { |
|||
return $this->test($args); |
|||
} |
|||
|
|||
/** |
|||
* Runs a quick subset of the test suite |
|||
* |
|||
* See help for the "test" task for more details. |
|||
*/ |
|||
public function testQuick(array $args): Result { |
|||
return $this->test(array_merge(["--exclude-group", "slow,optional"], $args)); |
|||
} |
|||
|
|||
/** Produces a code coverage report |
|||
* |
|||
* By default this task produces an HTML-format coverage report in |
|||
* arsse/tests/coverage/. Additional reports may be produced by passing |
|||
* arguments to this task as one would to PHPUnit. |
|||
* |
|||
* Robo first tries to use phpdbg and will fall back to Xdebug if available. |
|||
* Because Xdebug slows down non-coverage tasks, however, phpdbg is highly |
|||
* recommanded is debugging facilities are not otherwise needed. |
|||
*/ |
|||
public function coverage(array $args): Result { |
|||
// run tests with code coverage reporting enabled |
|||
$exec = $this->findCoverageEngine(); |
|||
$execpath = realpath(self::BASE."vendor-bin/phpunit/vendor/phpunit/phpunit/phpunit"); |
|||
$confpath = realpath(self::BASE_TEST."phpunit.xml"); |
|||
return $this->taskExec($exec)->arg($execpath)->option("-c", $confpath)->option("--coverage-html", self::BASE_TEST."coverage")->args($args)->run(); |
|||
} |
|||
|
|||
protected function findCoverageEngine(): string { |
|||
$null = null; |
|||
$code = 0; |
|||
exec("phpdbg --version", $null, $code); |
|||
if (!$code) { |
|||
return "phpdbg -qrr"; |
|||
} else { |
|||
return "php"; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,10 @@ |
|||
#! /bin/sh |
|||
base=`dirname "$0"` |
|||
roboCommand="$1" |
|||
|
|||
shift |
|||
if [ "$1" == "clean" ]; then |
|||
"$base/vendor/bin/robo" "$roboCommand" $* |
|||
else |
|||
"$base/vendor/bin/robo" "$roboCommand" -- $* |
|||
fi |
@ -0,0 +1,21 @@ |
|||
@echo off |
|||
setlocal |
|||
set base=%~dp0 |
|||
set roboCommand=%1 |
|||
|
|||
rem get all arguments except the first |
|||
shift |
|||
set "args=" |
|||
:parse |
|||
if "%~1" neq "" ( |
|||
set args=%args% %1 |
|||
shift |
|||
goto :parse |
|||
) |
|||
if defined args set args=%args:~1% |
|||
|
|||
if "%1"=="clean" ( |
|||
call "%base%vendor\bin\robo" "%roboCommand%" %args% |
|||
) else ( |
|||
call "%base%vendor\bin\robo" "%roboCommand%" -- %args% |
|||
) |
@ -0,0 +1,13 @@ |
|||
<?php |
|||
/** @license MIT |
|||
* Copyright 2018 J. King et al. |
|||
* See LICENSE and AUTHORS files for details */ |
|||
|
|||
declare(strict_types=1); |
|||
namespace MensBeam\UTF8; |
|||
|
|||
const NS_BASE = __NAMESPACE__."\\"; |
|||
define(NS_BASE."BASE", dirname(__DIR__).DIRECTORY_SEPARATOR); |
|||
ini_set("memory_limit", "-1"); |
|||
error_reporting(\E_ALL); |
|||
require_once BASE."vendor".DIRECTORY_SEPARATOR."autoload.php"; |
@ -0,0 +1,21 @@ |
|||
<?xml version="1.0"?> |
|||
<phpunit |
|||
colors="true" |
|||
bootstrap="bootstrap.php" |
|||
convertErrorsToExceptions="false" |
|||
convertNoticesToExceptions="false" |
|||
convertWarningsToExceptions="false" |
|||
beStrictAboutTestsThatDoNotTestAnything="true" |
|||
beStrictAboutOutputDuringTests="true" |
|||
beStrictAboutTestSize="true" |
|||
stopOnError="true"> |
|||
|
|||
<filter> |
|||
<whitelist processUncoveredFilesFromWhitelist="true"> |
|||
<directory suffix=".php">../lib</directory> |
|||
</whitelist> |
|||
</filter> |
|||
|
|||
<testsuites> |
|||
</testsuites> |
|||
</phpunit> |
@ -0,0 +1,5 @@ |
|||
{ |
|||
"require": { |
|||
"friendsofphp/php-cs-fixer": "^2.8" |
|||
} |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,5 @@ |
|||
{ |
|||
"require": { |
|||
"phpunit/phpunit": "^6.5" |
|||
} |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,5 @@ |
|||
{ |
|||
"require": { |
|||
"consolidation/robo": "^1.1" |
|||
} |
|||
} |
File diff suppressed because it is too large
Loading…
Reference in new issue