From 0b9462af2e2c32d7010d5e4ca89203cde7e3461e Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Tue, 10 Sep 2024 11:57:31 +1200 Subject: [PATCH] MNT Resolve deprecation warning in test --- tests/php/Tasks/LinkFieldMigrationTaskTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/php/Tasks/LinkFieldMigrationTaskTest.php b/tests/php/Tasks/LinkFieldMigrationTaskTest.php index b03e5edc..81e265b7 100644 --- a/tests/php/Tasks/LinkFieldMigrationTaskTest.php +++ b/tests/php/Tasks/LinkFieldMigrationTaskTest.php @@ -3,6 +3,7 @@ namespace SilverStripe\LinkField\Tests\Tasks; use LogicException; +use ReflectionClass; use ReflectionMethod; use ReflectionProperty; use RuntimeException; @@ -1015,9 +1016,8 @@ public function testCheckForBrokenLinks(bool $hasBrokenLinks): void public function testCheckForBrokenLinksWithHtmlOutput(bool $hasBrokenLinks): void { // Make sure we get HTML output - $reflectionCli = new ReflectionProperty(Environment::class, 'isCliOverride'); - $reflectionCli->setAccessible(true); - $reflectionCli->setValue(false); + $reflectionCli = new ReflectionClass(Environment::class); + $reflectionCli->setStaticPropertyValue('isCliOverride', false); try { $brokenLinkFixtures = $this->getBrokenLinkFixtures($hasBrokenLinks); $this->startCapturingOutput(); @@ -1062,7 +1062,7 @@ public function testCheckForBrokenLinksWithHtmlOutput(bool $hasBrokenLinks): voi } } finally { // Make sure we unset the CLI override - $reflectionCli->setValue(null); + $reflectionCli->setStaticPropertyValue('isCliOverride', null); } }