From 227bb5ee6a188fc3c20528941825b8ab4c9da35b Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 15 Jan 2025 12:08:25 +1300 Subject: [PATCH] MNT Make data providers static --- tests/php/Core/XssSanitiserTest.php | 8 ++++---- tests/php/Forms/FormMessageTest.php | 4 ++-- tests/php/View/Shortcodes/EmbedShortcodeProviderTest.php | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/php/Core/XssSanitiserTest.php b/tests/php/Core/XssSanitiserTest.php index 0d1ef959447..7d7b297e1a7 100644 --- a/tests/php/Core/XssSanitiserTest.php +++ b/tests/php/Core/XssSanitiserTest.php @@ -11,7 +11,7 @@ class XssSanitiserTest extends SapphireTest { protected $usesDatabase = false; - public function provideSanitise(): array + public static function provideSanitise(): array { // Most of these scenarios are inspired by Symfony's HtmlSanitizerAllTest scenarios return [ @@ -341,7 +341,7 @@ public function testSanitiseElement(string $input, string $expected): void $this->assertSame($expected, $htmlValue->getContent()); } - public function provideSanitiseElementsAllowed(): array + public static function provideSanitiseElementsAllowed(): array { return [ 'disallow these by default' => [ @@ -374,7 +374,7 @@ public function testSanitiseElementsAllowed(string $input, ?array $removeElement $this->assertSame($expected, $sanitiser->sanitiseString($input)); } - public function provideSanitiseAttributesAllowed(): array + public static function provideSanitiseAttributesAllowed(): array { return [ 'disallow these by default' => [ @@ -425,7 +425,7 @@ public function testSanitiseAttributesAllowed(string $input, ?array $removeAttri $this->assertSame($expected, $sanitiser->sanitiseString($input)); } - public function provideSanitiseNoKeepInnerHtml(): array + public static function provideSanitiseNoKeepInnerHtml(): array { return [ 'keeps inner html' => [ diff --git a/tests/php/Forms/FormMessageTest.php b/tests/php/Forms/FormMessageTest.php index 02f689a7378..e6a6fe29db4 100644 --- a/tests/php/Forms/FormMessageTest.php +++ b/tests/php/Forms/FormMessageTest.php @@ -6,13 +6,13 @@ use SilverStripe\Core\XssSanitiser; use SilverStripe\Dev\SapphireTest; use SilverStripe\Forms\Tests\FormMessageTest\TestFormMessage; -use SilverStripe\ORM\ValidationResult; +use SilverStripe\Core\Validation\ValidationResult; class FormMessageTest extends SapphireTest { protected $usesDatabase = false; - public function provideGetMessage(): array + public static function provideGetMessage(): array { return [ 'empty HTML' => [ diff --git a/tests/php/View/Shortcodes/EmbedShortcodeProviderTest.php b/tests/php/View/Shortcodes/EmbedShortcodeProviderTest.php index 2cac3fe3712..984a8a53dcb 100644 --- a/tests/php/View/Shortcodes/EmbedShortcodeProviderTest.php +++ b/tests/php/View/Shortcodes/EmbedShortcodeProviderTest.php @@ -222,7 +222,7 @@ public function testOnlyWhitelistedAttributesAllowed() ); } - public function provideSandboxHtml(): array + public static function provideSandboxHtml(): array { return [ 'normal' => [