Compare commits

...

6 Commits

Author SHA1 Message Date
Steve Boyd
615402d788 Merge branch '5' into 6 2024-10-22 19:18:03 +13:00
github-actions
16cb2702af Merge branch '5.3' into 5 2024-10-22 05:33:36 +00:00
Guy Sartorelli
fe39a2a046
Merge pull request #11438 from creative-commoners/pulls/5.3/fix-unit-test
MNT Fix unit test
2024-10-22 18:32:46 +13:00
Steve Boyd
6df8732761 MNT Fix unit test 2024-10-22 17:56:01 +13:00
Guy Sartorelli
662ac9d1f9
Merge pull request #11432 from creative-commoners/pulls/6/fix-definemethods
MNT Fix unit tests
2024-10-22 16:25:32 +13:00
Steve Boyd
983e90b25e MNT Fix unit tests 2024-10-22 15:50:25 +13:00
4 changed files with 12 additions and 4 deletions

View File

@ -511,7 +511,7 @@ trait Extensible
// Setup all extension instances for this instance // Setup all extension instances for this instance
$this->extension_instances = []; $this->extension_instances = [];
foreach (ClassInfo::ancestry(static::class) as $class) { foreach (ClassInfo::ancestry(static::class) as $class) {
if (in_array($class, self::$unextendable_classes)) { if (in_array($class, self::class::$unextendable_classes)) {
continue; continue;
} }
$extensions = Config::inst()->get($class, 'extensions', Config::UNINHERITED | Config::EXCLUDE_EXTRA_SOURCES); $extensions = Config::inst()->get($class, 'extensions', Config::UNINHERITED | Config::EXCLUDE_EXTRA_SOURCES);

View File

@ -391,7 +391,7 @@ class Deprecation
} }
// Getting a backtrace is slow, so we only do it if we need it // Getting a backtrace is slow, so we only do it if we need it
$backtrace = null; $backtrace = [];
// Get the calling scope // Get the calling scope
if ($scope == Deprecation::SCOPE_METHOD) { if ($scope == Deprecation::SCOPE_METHOD) {

View File

@ -111,8 +111,8 @@ class DeprecationTest extends SapphireTest
'Will be removed without equivalent functionality to replace it.', 'Will be removed without equivalent functionality to replace it.',
'Called from SilverStripe\Dev\Tests\DeprecationTest->testNoticeNoReplacement.' 'Called from SilverStripe\Dev\Tests\DeprecationTest->testNoticeNoReplacement.'
]); ]);
$this->expectDeprecation(); $this->expectException(DeprecationTestException::class);
$this->expectDeprecationMessage($message); $this->expectExceptionMessage($message);
$this->enableDeprecationNotices(true); $this->enableDeprecationNotices(true);
$ret = $this->myDeprecatedMethodNoReplacement(); $ret = $this->myDeprecatedMethodNoReplacement();
$this->assertSame('abc', $ret); $this->assertSame('abc', $ret);

View File

@ -32,6 +32,14 @@ class VersionedMemberAuthenticatorTest extends SapphireTest
// Remove password validation // Remove password validation
Member::set_password_validator(null); Member::set_password_validator(null);
// Explicity add the Versioned extension to Member, even though it's already in $required_extensions.
// This is done to call `unset(self::class::$extra_methods[strtolower($subclass)]);` in
// Extensible::add_extension() so when CustomMethods::getExtraMethodConfig() updates the $extra_methods
// it will include methods of Versioned such as publishSingle()
// This issue will only occur when running subsequent unit test classes in the same process, rather than this
// this unit test class in isolation
Member::add_extension(Versioned::class);
} }
protected function tearDown(): void protected function tearDown(): void