1
0
mirror of https://github.com/danog/process.git synced 2024-11-30 04:39:04 +01:00

Fix Travis

This commit is contained in:
Niklas Keller 2018-07-24 20:56:50 +02:00
parent 75ec5b7c08
commit 8902aea332
12 changed files with 52 additions and 60 deletions

40
.php_cs
View File

@ -1,40 +0,0 @@
<?php
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
"@PSR1" => true,
"@PSR2" => true,
"braces" => [
"allow_single_line_closure" => true,
"position_after_functions_and_oop_constructs" => "same",
],
"array_syntax" => ["syntax" => "short"],
"cast_spaces" => true,
"combine_consecutive_unsets" => true,
"function_to_constant" => true,
"no_multiline_whitespace_before_semicolons" => true,
"no_unused_imports" => true,
"no_useless_else" => true,
"no_useless_return" => true,
"no_whitespace_before_comma_in_array" => true,
"no_whitespace_in_blank_line" => true,
"non_printable_character" => true,
"normalize_index_brace" => true,
"ordered_imports" => true,
"php_unit_construct" => true,
"php_unit_dedicate_assert" => true,
"php_unit_fqcn_annotation" => true,
"phpdoc_summary" => true,
"phpdoc_types" => true,
"psr4" => true,
"return_type_declaration" => ["space_before" => "none"],
"short_scalar_cast" => true,
"single_blank_line_before_namespace" => true,
])
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__ . "/examples")
->in(__DIR__ . "/lib")
->in(__DIR__ . "/test")
);

13
.php_cs.dist Normal file
View File

@ -0,0 +1,13 @@
<?php
$config = new Amp\CodeStyle\Config();
$config->getFinder()
->in(__DIR__ . '/examples')
->in(__DIR__ . '/lib')
->in(__DIR__ . '/test');
$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__;
$config->setCacheFile($cacheDir . '/.php_cs.cache');
return $config;

View File

@ -3,14 +3,11 @@ sudo: false
language: php
php:
- 7.0
- 7.1
- 7.2
- nightly
matrix:
allow_failures:
- php: nightly
# allow_failures:
# - php: nightly
fast_finish: true
env:
@ -20,6 +17,7 @@ before_install:
- phpenv config-rm xdebug.ini || echo "No xdebug config."
install:
- travis/install-async.sh
- composer update -n --prefer-dist
- wget https://github.com/php-coveralls/php-coveralls/releases/download/v1.0.2/coveralls.phar
- chmod +x coveralls.phar

View File

@ -10,9 +10,9 @@
"amphp/byte-stream": "dev-ext-async"
},
"require-dev": {
"phpunit/phpunit": "^6",
"amphp/php-cs-fixer-config": "dev-master",
"amphp/phpunit-util": "^1",
"friendsofphp/php-cs-fixer": "^2.3"
"phpunit/phpunit": "^6"
},
"license": "MIT",
"authors": [
@ -44,5 +44,13 @@
"platform": {
"php": "7.2.0"
}
},
"scripts": {
"check": [
"@cs",
"@test"
],
"cs": "php-cs-fixer fix -v --diff --dry-run",
"cs-fix": "php-cs-fixer fix -v --diff"
}
}

View File

@ -1,6 +1,6 @@
<?php
include dirname(__DIR__) . "/vendor/autoload.php";
include \dirname(__DIR__) . "/vendor/autoload.php";
use Amp\ByteStream\ResourceOutputStream;
use Amp\Process\Process;

View File

@ -1,6 +1,6 @@
<?php
include dirname(__DIR__) . "/vendor/autoload.php";
include \dirname(__DIR__) . "/vendor/autoload.php";
use Amp\ByteStream\ResourceOutputStream;
use Amp\Process\Process;

View File

@ -1,6 +1,6 @@
<?php
include dirname(__DIR__) . "/vendor/autoload.php";
include \dirname(__DIR__) . "/vendor/autoload.php";
use Amp\Process\Process;

View File

@ -1,8 +1,7 @@
<?php
require dirname(__DIR__) . "/vendor/autoload.php";
require \dirname(__DIR__) . "/vendor/autoload.php";
use Amp\Loop;
use Amp\Process\Process;
use function Amp\ByteStream\buffer;

View File

@ -38,7 +38,7 @@ final class Runner implements ProcessRunner
$wrapperPath = self::WRAPPER_EXE_PATH;
// We can't execute the exe from within the PHAR, so copy it out...
if (strncmp($wrapperPath, "phar://", 7) === 0) {
if (\strncmp($wrapperPath, "phar://", 7) === 0) {
if (self::$pharWrapperPath === null) {
self::$pharWrapperPath = \tempnam(\sys_get_temp_dir(), "amphp-process-wrapper-");
\copy(self::WRAPPER_EXE_PATH, self::$pharWrapperPath);

View File

@ -79,7 +79,7 @@ class ProcessTest extends TestCase
public function testGetWorkingDirectoryIsDefault(): void
{
$process = new Process(self::CMD_PROCESS);
$this->assertSame(getcwd(), $process->getWorkingDirectory());
$this->assertSame(\getcwd(), $process->getWorkingDirectory());
}
public function testGetWorkingDirectoryIsCustomized(): void
@ -303,7 +303,7 @@ class ProcessTest extends TestCase
/** @noinspection PhpUnhandledExceptionInspection */
$process->getStdin()->write("exit " . $count);
$this->assertSame(str_repeat(".", $count), (new Message($process->getStdout()))->buffer());
$this->assertSame(\str_repeat(".", $count), (new Message($process->getStdout()))->buffer());
$this->assertSame(0, $process->join());
}
}

View File

@ -1,15 +1,15 @@
<?php
$content = fread(STDIN, 1024);
$content = \fread(STDIN, 1024);
$command = explode(" ", $content);
$command = \explode(" ", $content);
if (count($command) !== 2) {
if (\count($command) !== 2) {
exit(1);
}
if ($command[0] === "exit") {
echo str_repeat(".", (int) $command[1]);
echo \str_repeat(".", (int) $command[1]);
exit;
}

14
travis/install-async.sh Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
wget https://github.com/concurrent-php/ext-async/archive/master.tar.gz -O /tmp/php-async.tar.gz -q
mkdir php-async && tar -xf /tmp/php-async.tar.gz -C php-async --strip-components=1
pushd php-async
phpize
./configure
make
make install
popd
echo "extension=async" >> "$(php -r 'echo php_ini_loaded_file();')"