diff --git a/.travis.yml b/.travis.yml index d850c56..36a8175 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ script: # Run with phpdbg or xdebug as soon as one of both doesn't segfault anymore - vendor/bin/phpunit --coverage-text --coverage-clover build/logs/clover.xml - (for f in examples/*.php; do echo $f && if ! php $f; then echo '!! failed !!' && exit 1; fi && echo "-------"; done) - - PHP_CS_FIXER_IGNORE_ENV=1 php vendor/bin/php-cs-fixer --diff --dry-run -v fix + - PHP_CS_FIXER_IGNORE_ENV=1 composer fix-syntax -- --dry-run after_script: - ./coveralls.phar -v diff --git a/composer.json b/composer.json index a34c517..b06ee53 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,11 @@ "src/functions.php" ] }, + "autoload-dev": { + "psr-4": { + "Amp\\ParallelFunctions\\Test\\": "test" + } + }, "require": { "php": ">=7", "amphp/parallel": "^0.1.8 || ^0.2", @@ -32,5 +37,8 @@ "platform": { "php": "7.0.0" } + }, + "scripts": { + "fix-syntax": "php vendor/bin/php-cs-fixer --diff -v fix" } } diff --git a/test/FilterTest.php b/test/FilterTest.php index 03904f7..8a0edd1 100644 --- a/test/FilterTest.php +++ b/test/FilterTest.php @@ -74,4 +74,16 @@ class FilterTest extends TestCase { $this->assertStringEqualsFile($files[2][1], '2'); } } + + public function testFilterWithNullCallable() { + $this->expectException(\Error::class); + + $files = [ + [0, \tempnam(\sys_get_temp_dir(), 'amp-parallel-functions-')], + [1, \tempnam(\sys_get_temp_dir(), 'amp-parallel-functions-')], + [2, \tempnam(\sys_get_temp_dir(), 'amp-parallel-functions-')], + ]; + + wait(parallelFilter($files, null, ARRAY_FILTER_USE_BOTH)); + } }