mirror of
https://github.com/danog/process.git
synced 2025-01-22 13:51:43 +01:00
Testing with Travis CI
This commit is contained in:
parent
c449c52e75
commit
fdf63c3866
22
.travis.yml
Normal file
22
.travis.yml
Normal file
@ -0,0 +1,22 @@
|
||||
sudo: false
|
||||
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
|
||||
before_script:
|
||||
- phpenv rehash
|
||||
- php -r 'exit((int) (PHP_MAJOR_VERSION < 7));' || (yes "" | pecl install "channel://pecl.php.net/libevent-0.1.0")
|
||||
- php -r 'exit((int) (PHP_MAJOR_VERSION < 7));' || (yes "" | pecl install ev)
|
||||
- php -r 'exit((int) (PHP_MAJOR_VERSION >= 7));' || (mkdir libuv && (curl -L https://github.com/libuv/libuv/archive/v1.6.1.tar.gz | tar xzf -) && cd libuv-1.6.1 && ./autogen.sh && ./configure --prefix=$(readlink -f `pwd`/../libuv) && make && make install && cd ..)
|
||||
- php -r 'exit((int) (PHP_MAJOR_VERSION >= 7));' || (git clone https://github.com/bwoebi/php-uv && cd php-uv && phpize && ./configure --with-uv=$(readlink -f `pwd`/../libuv) && make install && (echo "extension = uv.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini) && cd ..)
|
||||
- composer self-update
|
||||
- composer require satooshi/php-coveralls:dev-master
|
||||
- composer install
|
||||
|
||||
script:
|
||||
- $(php -r 'if (PHP_MAJOR_VERSION >= 7) echo "phpdbg -qrr"; else echo "php";') vendor/bin/phpunit --coverage-text --coverage-clover build/logs/clover.xml
|
||||
- php vendor/bin/php-cs-fixer --diff --dry-run -v fix
|
12
phpunit.xml
Normal file
12
phpunit.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<phpunit bootstrap="./tests/bootstrap.php" colors="true">
|
||||
<testsuites>
|
||||
<testsuite name="Tests">
|
||||
<directory>./tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist addUncoveredFilesFromWhitelist="true">
|
||||
<directory>./lib</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
@ -6,7 +6,7 @@ use Amp\Process;
|
||||
|
||||
abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
const CMD_PROCESS = "php -r 'sleep(2);'";
|
||||
const CMD_PROCESS = "php -r 'sleep(2); echo \"foo\"'";
|
||||
|
||||
abstract function testReactor();
|
||||
|
||||
@ -30,4 +30,23 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase {
|
||||
public function testPid(Process $process) {
|
||||
$this->assertInternalType('int', $process->pid());
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCommandCanRun
|
||||
*/
|
||||
public function testKillProcess(Process $process) {
|
||||
$return = $process->kill();
|
||||
$this->assertTrue($return);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function testProcessResolvePromise() {
|
||||
$process = new Process(self::CMD_PROCESS);
|
||||
$promise = $process->exec();
|
||||
$this->assertInstanceOf('\Amp\Promise', $promise);
|
||||
$result = (yield $promise);
|
||||
$this->assertSame('foo', $result);
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace Amp\Process\Test;
|
||||
|
||||
|
||||
use Amp\LibeventReactor;
|
||||
|
||||
class LibeventReactorProcessTest extends AbstractProcessTest {
|
||||
|
5
tests/bootstrap.php
Normal file
5
tests/bootstrap.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
namespace Amp\Test;
|
||||
|
||||
require __DIR__ . "/../vendor/autoload.php";
|
||||
error_reporting(E_ALL);
|
Loading…
x
Reference in New Issue
Block a user