Skip to content

Commit

Permalink
Allow PHPUnit 10 and 11 for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
aimeos committed Nov 6, 2024
1 parent 4e98b88 commit f813bc1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"require-dev": {
"squizlabs/php_codesniffer": "^3.5",
"php-coveralls/php-coveralls": "~2.0",
"phpunit/phpunit": "~7.0||~8.0||~9.0"
"phpunit/phpunit": "~7.0||~8.0||~9.0||~10.0||~11.0"
},
"autoload": {
"psr-4": {
Expand Down
20 changes: 7 additions & 13 deletions tests/MapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1247,20 +1247,14 @@ public function testGrepException()
{
set_error_handler( function( $errno, $str, $file, $line ) { return true; } );

$this->expectException( \RuntimeException::class );
Map::from( [] )->grep( 'b' );
}


public function testGrepWarning()
{
if( method_exists( $this, 'expectWarning' ) ) {
$this->expectWarning(); // PHPUnit 8+
} else {
$this->expectException( \PHPUnit\Framework\Error\Warning::class ); // PHP 7.1
try {
Map::from( [] )->grep( 'b' );
$this->fail( 'An expected RuntimeException has not been raised' );
} catch( \RuntimeException $e ) {
$this->assertStringContainsString( 'Regular expression error', $e->getMessage() );
} finally {
restore_error_handler();
}

Map::from( [] )->grep( 'b' );
}


Expand Down

0 comments on commit f813bc1

Please sign in to comment.