diff core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 1fec387a4317
children
line wrap: on
line diff
--- a/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php	Thu Feb 28 13:21:36 2019 +0000
@@ -18,6 +18,7 @@
  * Tests marking strings as safe.
  *
  * @group Utility
+ * @group legacy
  * @coversDefaultClass \Drupal\Component\Utility\SafeMarkup
  */
 class SafeMarkupTest extends TestCase {
@@ -35,6 +36,7 @@
    * Tests SafeMarkup::isSafe() with different objects.
    *
    * @covers ::isSafe
+   * @expectedDeprecation SafeMarkup::isSafe() is scheduled for removal in Drupal 9.0.0. Instead, you should just check if a variable is an instance of \Drupal\Component\Render\MarkupInterface. See https://www.drupal.org/node/2549395.
    */
   public function testIsSafe() {
     $safe_string = $this->getMockBuilder('\Drupal\Component\Render\MarkupInterface')->getMock();
@@ -48,6 +50,7 @@
    *
    * @dataProvider providerCheckPlain
    * @covers ::checkPlain
+   * @expectedDeprecation SafeMarkup::checkPlain() is scheduled for removal in Drupal 9.0.0. Rely on Twig's auto-escaping feature, or use the @link theme_render #plain_text @endlink key when constructing a render array that contains plain text in order to use the renderer's auto-escaping feature. If neither of these are possible, \Drupal\Component\Utility\Html::escape() can be used in places where explicit escaping is needed. See https://www.drupal.org/node/2549395.
    *
    * @param string $text
    *   The text to provide to SafeMarkup::checkPlain().
@@ -107,6 +110,7 @@
    *
    * @dataProvider providerFormat
    * @covers ::format
+   * @expectedDeprecation SafeMarkup::format() is scheduled for removal in Drupal 9.0.0. Use \Drupal\Component\Render\FormattableMarkup. See https://www.drupal.org/node/2549395.
    *
    * @param string $string
    *   The string to run through SafeMarkup::format().
@@ -125,10 +129,6 @@
     $result = SafeMarkup::format($string, $args);
     $this->assertEquals($expected, (string) $result, $message);
     $this->assertEquals($expected_is_safe, $result instanceof MarkupInterface, 'SafeMarkup::format correctly sets the result as safe or not safe.');
-
-    foreach ($args as $arg) {
-      $this->assertSame($arg instanceof SafeMarkupTestMarkup, SafeMarkup::isSafe($arg));
-    }
   }
 
   /**