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); } }