From 8f02aea34ee47fecb1d96a91f76f9151955975b9 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> Date: Wed, 11 Sep 2024 12:15:39 +1200 Subject: [PATCH] MNT Resolve deprecation warning in test (#332) --- 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); } }