Compare commits

...

5 Commits

Author SHA1 Message Date
Sunny Side Up
81e54ffdb3
Merge 5c9c5519f3 into 16cb2702af 2024-10-22 18:46:04 +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
Sunny Side Up
5c9c5519f3
FIX: equate empty string to null for more intuitive results 2024-09-08 12:21:22 +12:00
2 changed files with 19 additions and 0 deletions

View File

@ -40,7 +40,18 @@ trait SearchFilterable
$filterServiceName = "DataListFilter.{$secondArg}"; $filterServiceName = "DataListFilter.{$secondArg}";
} }
} }
if (is_array($value)) {
foreach ($value as $key => $val) {
if ($val === '' || $val === 'null') {
$value[] = null;
}
}
} else {
if ($value === '' || $value === 'null') {
$value = ['', null];
}
}
// Build instance // Build instance
return Injector::inst()->create($filterServiceName, $fieldName, $value, $modifiers); return Injector::inst()->create($filterServiceName, $fieldName, $value, $modifiers);
} }

View File

@ -43,6 +43,14 @@ class VersionedMemberAuthenticatorTest extends SapphireTest
return; return;
} }
// 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);
// Enforce dummy validation (this can otherwise be influenced by recipe config) // Enforce dummy validation (this can otherwise be influenced by recipe config)
Deprecation::withSuppressedNotice( Deprecation::withSuppressedNotice(
fn() => PasswordValidator::singleton() fn() => PasswordValidator::singleton()