Skip to content

Commit

Permalink
updated tests to work with php8 and phpunit11 and fixed a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
qxsch committed Feb 11, 2024
1 parent 6473b7c commit b7cb34e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 40 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
vendor
/.phpunit.*
/composer.phar
/phpDocumentor.phar
/phpunit
52 changes: 25 additions & 27 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.3/phpunit.xsd"
backupGlobals="true"
backupStaticAttributes="false"
bootstrap="./autoload.php"
cacheTokens="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
forceCoversAnnotation="false"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
stopOnRisky="false"
timeoutForSmallTests="1"
timeoutForMediumTests="10"
timeoutForLargeTests="60"
verbose="false">
<testsuites>
<testsuite name="Application Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd"
backupGlobals="true"
bootstrap="./autoload.php"
colors="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
stopOnRisky="false"
timeoutForSmallTests="1"
timeoutForMediumTests="10"
timeoutForLargeTests="60"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
requireCoverageMetadata="false"
>
<testsuites>
<testsuite name="Application Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<source/>
</phpunit>
2 changes: 1 addition & 1 deletion src/WorkerPoolResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => ''
Expand Down
10 changes: 4 additions & 6 deletions tests/ClosureWorkerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
10 changes: 4 additions & 6 deletions tests/WorkerPoolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

/**
Expand Down

0 comments on commit b7cb34e

Please sign in to comment.