Skip to content

Commit

Permalink
PHPUnit 10
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed Feb 7, 2023
1 parent 0bd5fbf commit 900a288
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"doctrine/coding-standard": "^9.0.2 || ^11.0",
"phpbench/phpbench": "^0.16.10 || ^1.0",
"phpstan/phpstan": "~1.4.10 || 1.9.14",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10",
"psr/log": "^1 || ^2 || ^3",
"squizlabs/php_codesniffer": "3.7.1",
"symfony/cache": "^4.4 || ^5.4 || ^6.0",
Expand Down
5 changes: 4 additions & 1 deletion tests/Doctrine/Tests/OrmFunctionalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use Doctrine\Tests\DbalExtensions\QueryLog;
use Doctrine\Tests\DbalTypes\Rot13Type;
use Doctrine\Tests\EventListener\CacheMetadataListener;
use Doctrine\Tests\PHPUnitCompatibility\OnNotSuccessfulTestCompat;
use Exception;
use PHPUnit\Framework\AssertionFailedError;
use PHPUnit\Framework\Constraint\Count;
Expand Down Expand Up @@ -62,6 +63,8 @@
*/
abstract class OrmFunctionalTestCase extends OrmTestCase
{
use OnNotSuccessfulTestCompat;

/**
* The metadata cache shared between all functional tests.
*
Expand Down Expand Up @@ -840,7 +843,7 @@ final protected function createSchemaManager(): AbstractSchemaManager
}

/** @throws Throwable */
protected function onNotSuccessfulTest(Throwable $e): void
private function doOnNotSuccessfulTest(Throwable $e): void
{
if ($e instanceof AssertionFailedError || $e instanceof Warning) {
throw $e;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

namespace Doctrine\Tests\PHPUnitCompatibility;

use Throwable;

use const PHP_VERSION_ID;

if (PHP_VERSION_ID >= 80100) {
trait OnNotSuccessfulTestCompat
{
protected function onNotSuccessfulTest(Throwable $e): never
{
$this->doOnNotSuccessfulTest($e);
}
}
} else {
trait OnNotSuccessfulTestCompat
{
protected function onNotSuccessfulTest(Throwable $e): void
{
$this->doOnNotSuccessfulTest($e);
}
}
}

0 comments on commit 900a288

Please sign in to comment.