diff --git a/composer.json b/composer.json index a7a51e3..b1c4504 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "doctrine/coding-standard": "^9 || ^12", "phpstan/phpstan": "1.4.10 || 2.0.3", "phpstan/phpstan-phpunit": "^1.0 || ^2", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5 || ^10.5 || ^11.5", "psr/log": "^1 || ^2 || ^3" }, "suggest": { diff --git a/tests/DeprecationTest.php b/tests/DeprecationTest.php index d63ca20..70f7aaa 100644 --- a/tests/DeprecationTest.php +++ b/tests/DeprecationTest.php @@ -14,6 +14,7 @@ use ReflectionClass; use ReflectionProperty; +use function restore_error_handler; use function set_error_handler; class DeprecationTest extends TestCase @@ -79,6 +80,7 @@ public function testDeprecation(): void ); $this->assertEquals(2, Deprecation::getUniqueTriggeredDeprecationsCount()); + restore_error_handler(); } public function testDeprecationWithoutDeduplication(): void @@ -100,6 +102,7 @@ public function testDeprecationWithoutDeduplication(): void ); $this->assertEquals(1, Deprecation::getUniqueTriggeredDeprecationsCount()); + restore_error_handler(); $this->expectErrorHandler( 'this is deprecated foo 2222 (DeprecationTest.php:%d called by TestCase.php:%d, https://github.com/doctrine/deprecations/2222, package doctrine/orm)', @@ -116,6 +119,7 @@ public function testDeprecationWithoutDeduplication(): void ); $this->assertEquals(2, Deprecation::getUniqueTriggeredDeprecationsCount()); + restore_error_handler(); } public function testDisableResetsCounts(): void @@ -212,6 +216,7 @@ public function testDeprecationIfCalledFromOutside(): void Foo::triggerDependencyWithDeprecation(); $this->assertEquals(1, Deprecation::getUniqueTriggeredDeprecationsCount()); + restore_error_handler(); } public function testDeprecationIfCalledFromOutsideNotTriggeringFromInside(): void @@ -247,6 +252,7 @@ public function testDeprecationCalledFromOutsideInRoot(): void RootDeprecation::run(); $this->assertEquals(1, Deprecation::getUniqueTriggeredDeprecationsCount()); + restore_error_handler(); } public function testDeprecationTrackByEnv(): void @@ -279,6 +285,7 @@ public function testDeprecationTriggerByEnv(): void Deprecation::trigger('Foo', __METHOD__, 'message'); $this->assertSame(1, Deprecation::getUniqueTriggeredDeprecationsCount()); + restore_error_handler(); } public function testDeprecationTriggeredFromNativeCode(): void @@ -293,5 +300,6 @@ public function testDeprecationTriggeredFromNativeCode(): void $ref->newInstance(); $this->assertSame(1, Deprecation::getUniqueTriggeredDeprecationsCount()); + restore_error_handler(); } } diff --git a/tests/VerifyDeprecationsTest.php b/tests/VerifyDeprecationsTest.php index 1d4f6de..f4dc82e 100644 --- a/tests/VerifyDeprecationsTest.php +++ b/tests/VerifyDeprecationsTest.php @@ -7,6 +7,7 @@ use Doctrine\Deprecations\PHPUnit\VerifyDeprecations; use PHPUnit\Framework\TestCase; +use function restore_error_handler; use function set_error_handler; class VerifyDeprecationsTest extends TestCase @@ -20,6 +21,11 @@ public function setUp(): void }); } + public function tearDown(): void + { + restore_error_handler(); + } + public function testExpectDeprecationWithIdentifier(): void { $this->expectDeprecationWithIdentifier('http://example.com');