From 983e90b25e041447bf1533948dcb79e325a27319 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 22 Oct 2024 15:50:25 +1300 Subject: [PATCH] MNT Fix unit tests --- src/Core/Extensible.php | 2 +- src/Dev/Deprecation.php | 2 +- tests/php/Dev/DeprecationTest.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Core/Extensible.php b/src/Core/Extensible.php index 95782feee..98163ba70 100644 --- a/src/Core/Extensible.php +++ b/src/Core/Extensible.php @@ -511,7 +511,7 @@ trait Extensible // Setup all extension instances for this instance $this->extension_instances = []; foreach (ClassInfo::ancestry(static::class) as $class) { - if (in_array($class, self::$unextendable_classes)) { + if (in_array($class, self::class::$unextendable_classes)) { continue; } $extensions = Config::inst()->get($class, 'extensions', Config::UNINHERITED | Config::EXCLUDE_EXTRA_SOURCES); diff --git a/src/Dev/Deprecation.php b/src/Dev/Deprecation.php index e8d1111a4..05050c4f1 100644 --- a/src/Dev/Deprecation.php +++ b/src/Dev/Deprecation.php @@ -391,7 +391,7 @@ class Deprecation } // Getting a backtrace is slow, so we only do it if we need it - $backtrace = null; + $backtrace = []; // Get the calling scope if ($scope == Deprecation::SCOPE_METHOD) { diff --git a/tests/php/Dev/DeprecationTest.php b/tests/php/Dev/DeprecationTest.php index 03f0154fd..811e2ca70 100644 --- a/tests/php/Dev/DeprecationTest.php +++ b/tests/php/Dev/DeprecationTest.php @@ -111,8 +111,8 @@ class DeprecationTest extends SapphireTest 'Will be removed without equivalent functionality to replace it.', 'Called from SilverStripe\Dev\Tests\DeprecationTest->testNoticeNoReplacement.' ]); - $this->expectDeprecation(); - $this->expectDeprecationMessage($message); + $this->expectException(DeprecationTestException::class); + $this->expectExceptionMessage($message); $this->enableDeprecationNotices(true); $ret = $this->myDeprecatedMethodNoReplacement(); $this->assertSame('abc', $ret);