Make use of composer scripts and add a further test

This commit is contained in:
peter279k 2017-12-16 17:35:40 +08:00 committed by Niklas Keller
parent a73ac158c3
commit d7f396df2b
3 changed files with 21 additions and 1 deletions

View File

@ -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

View File

@ -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"
}
}

View File

@ -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));
}
}