From b7cb34e4990c58ed12a8614ee3d7b8637fd27350 Mon Sep 17 00:00:00 2001 From: qxsch Date: Sun, 11 Feb 2024 21:18:35 +0100 Subject: [PATCH] updated tests to work with php8 and phpunit11 and fixed a bug --- .gitignore | 4 +++ phpunit.xml | 52 ++++++++++++++++++------------------- src/WorkerPoolResult.php | 2 +- tests/ClosureWorkerTest.php | 10 +++---- tests/WorkerPoolTest.php | 10 +++---- 5 files changed, 38 insertions(+), 40 deletions(-) diff --git a/.gitignore b/.gitignore index 22d0d82..772da1f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ vendor +/.phpunit.* +/composer.phar +/phpDocumentor.phar +/phpunit diff --git a/phpunit.xml b/phpunit.xml index 82d06f0..5af5408 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,29 +1,27 @@ - - - - ./tests/ - - + + + + ./tests/ + + + diff --git a/src/WorkerPoolResult.php b/src/WorkerPoolResult.php index 619b9a2..8ed8dd1 100644 --- a/src/WorkerPoolResult.php +++ b/src/WorkerPoolResult.php @@ -25,7 +25,7 @@ public function __construct(array $result) { } if(array_key_exists('abnormalChildReturnCode', $result)) { if(!array_key_exists('poolException', $result)) { - $result['poolException'] = new WorkerPoolException(array( + $result['poolException'] = new WorkerPoolExceptionResult(array( 'class' => 'RuntimeException', 'message' => 'The WorkerPool process reaper discovered an abnormal child return code: ' . $result['abnormalChildReturnCode'], 'trace' => '' diff --git a/tests/ClosureWorkerTest.php b/tests/ClosureWorkerTest.php index 6f509aa..5c7cb0a 100644 --- a/tests/ClosureWorkerTest.php +++ b/tests/ClosureWorkerTest.php @@ -5,12 +5,10 @@ use QXS\WorkerPool\ClosureWorker; use QXS\WorkerPool\Semaphore; -/** - * @requires extension pcntl - * @requires extension posix - * @requires extension sysvsem - * @requires extension sockets - */ +#[RequiresPhpExtension('pcntl')] +#[RequiresPhpExtension('posix')] +#[RequiresPhpExtension('sysvsem')] +#[RequiresPhpExtension('sockets')] class ClosureWorkerTest extends \PHPUnit\Framework\TestCase { public function testClosureMethods() { diff --git a/tests/WorkerPoolTest.php b/tests/WorkerPoolTest.php index 408d989..a3cadcf 100644 --- a/tests/WorkerPoolTest.php +++ b/tests/WorkerPoolTest.php @@ -4,12 +4,10 @@ use QXS\WorkerPool\WorkerPool; -/** - * @requires extension pcntl - * @requires extension posix - * @requires extension sysvsem - * @requires extension sockets - */ +#[RequiresPhpExtension('pcntl')] +#[RequiresPhpExtension('posix')] +#[RequiresPhpExtension('sysvsem')] +#[RequiresPhpExtension('sockets')] class WorkerPoolTest extends \PHPUnit\Framework\TestCase { /**