From b973c88648012149a4c9983b577312c7b7e8a5a7 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Mon, 16 Jan 2023 15:28:23 +1300 Subject: [PATCH] API Deprecate HTML4Value --- src/View/Parsers/HTML4Value.php | 16 ++++++++++++++++ tests/php/View/Parsers/HTML4ValueTest.php | 9 +++++++++ 2 files changed, 25 insertions(+) diff --git a/src/View/Parsers/HTML4Value.php b/src/View/Parsers/HTML4Value.php index 528802df9..263f59641 100644 --- a/src/View/Parsers/HTML4Value.php +++ b/src/View/Parsers/HTML4Value.php @@ -2,8 +2,24 @@ namespace SilverStripe\View\Parsers; +use SilverStripe\Dev\Deprecation; + +/* + * @deprecated 4.13.0 Will be removed without equivalent functionality to replace it + */ class HTML4Value extends HTMLValue { + public function __construct($fragment = null) + { + Deprecation::withNoReplacement(function () { + Deprecation::notice( + '4.13.0', + 'Will be removed without equivalent functionality to replace it', + Deprecation::SCOPE_CLASS + ); + }); + parent::__construct($fragment); + } /** * @param string $content diff --git a/tests/php/View/Parsers/HTML4ValueTest.php b/tests/php/View/Parsers/HTML4ValueTest.php index 833b10047..0f8645b94 100644 --- a/tests/php/View/Parsers/HTML4ValueTest.php +++ b/tests/php/View/Parsers/HTML4ValueTest.php @@ -2,11 +2,20 @@ namespace SilverStripe\View\Tests\Parsers; +use SilverStripe\Dev\Deprecation; use SilverStripe\Dev\SapphireTest; use SilverStripe\View\Parsers\HTML4Value; class HTML4ValueTest extends SapphireTest { + protected function setUp(): void + { + parent::setUp(); + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } + } + public function testInvalidHTMLSaving() { $value = new HTML4Value();