Update to PHPUnit 9 (#31)

This commit is contained in:
Owen Voke 2022-02-01 12:33:52 +00:00 committed by GitHub
parent 14ff70bceb
commit 4c67d25d39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 24 deletions

View File

@ -29,9 +29,9 @@
"opis/closure": "^3.0.7"
},
"require-dev": {
"amphp/phpunit-util": "^1.0",
"amphp/phpunit-util": "^2.0",
"friendsofphp/php-cs-fixer": "^2.9",
"phpunit/phpunit": "^6.5"
"phpunit/phpunit": "^9.5.11"
},
"config": {
"platform": {

View File

@ -1,16 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.0/phpunit.xsd">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Main">
<directory>test</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<listeners>
<listener class="Amp\PHPUnit\LoopReset"/>
</listeners>
</phpunit>

View File

@ -3,11 +3,11 @@
namespace Amp\ParallelFunctions\Test;
use Amp\MultiReasonException;
use Amp\PHPUnit\TestCase;
use function Amp\ParallelFunctions\parallelFilter;
use Amp\PHPUnit\AsyncTestCase;
use function Amp\Promise\wait;
class FilterTest extends TestCase {
class FilterTest extends AsyncTestCase {
public function testWithoutCallback() {
$input = [1, 0, 3, false, true, null];

View File

@ -3,11 +3,11 @@
namespace Amp\ParallelFunctions\Test;
use Amp\MultiReasonException;
use Amp\PHPUnit\TestCase;
use function Amp\ParallelFunctions\parallelMap;
use Amp\PHPUnit\AsyncTestCase;
use function Amp\Promise\wait;
class MapTest extends TestCase {
class MapTest extends AsyncTestCase {
public function testValidInput() {
$this->assertSame([3, 4, 5], wait(parallelMap([1, 2, 3], function ($input) {
return $input + 2;

View File

@ -4,11 +4,11 @@ namespace Amp\ParallelFunctions\Test;
use Amp\Parallel\Sync\SerializationException;
use Amp\Parallel\Worker\Pool;
use function Amp\ParallelFunctions\parallel;
use Amp\ParallelFunctions\Test\Fixture\TestCallables;
use Amp\PHPUnit\TestCase;
use Amp\PHPUnit\AsyncTestCase;
use Amp\Promise;
use Amp\Success;
use function Amp\ParallelFunctions\parallel;
class UnserializableClass {
public function __invoke() {
@ -21,7 +21,7 @@ class UnserializableClass {
}
}
class ParallelTest extends TestCase {
class ParallelTest extends AsyncTestCase {
public function testUnserializableClosure() {
$this->expectException(SerializationException::class);
$this->expectExceptionMessage("Unsupported callable: Serialization of 'class@anonymous' is not allowed");
@ -108,7 +108,11 @@ class ParallelTest extends TestCase {
public function testUnserializableClassStaticMethod() {
$this->expectException(\Error::class);
$this->expectExceptionMessage('Uncaught Error in worker with message "Class \'Amp\\ParallelFunctions\\Test\\UnserializableClass\' not found"');
$this->expectExceptionMessage(
PHP_VERSION_ID >= 80000 ?
'Uncaught Error in worker with message "Class "Amp\\ParallelFunctions\\Test\\UnserializableClass" not found"' :
'Uncaught Error in worker with message "Class \'Amp\\ParallelFunctions\\Test\\UnserializableClass\' not found"'
);
$callable = [UnserializableClass::class, 'staticMethod'];