Commit 15de0783 authored by catch's avatar catch
Browse files

Issue #3101247 by mondrake, longwave, Saurabh_sgh, alexpott, jhedstrom, xjm:...

Issue #3101247 by mondrake, longwave, Saurabh_sgh, alexpott, jhedstrom, xjm: Deprecate AssertHelperTrait::castSafeStrings() in favour of MarkupInterfaceComparator
parent c532b2f9
Loading
Loading
Loading
Loading
+1 −1
Changes for core/modules/block/tests/src/Kernel/BlockInterfaceTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ public function testBlockInterface() {
    $actual_form = $display_block->buildConfigurationForm([], $form_state);
    // Remove the visibility sections, as that just tests condition plugins.
    unset($actual_form['visibility'], $actual_form['visibility_tabs']);
    $this->assertIdentical($this->castSafeStrings($actual_form), $this->castSafeStrings($expected_form), 'Only the expected form elements were present.');
    $this->assertEquals($expected_form, $actual_form, 'Only the expected form elements were present.');

    $expected_build = [
      '#children' => 'My custom display message.',
+4 −7
Changes for core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php: 4 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@

namespace Drupal\Tests\book\Unit;

use Drupal\Tests\AssertHelperTrait;
use Drupal\Tests\UnitTestCase;

/**
@@ -11,8 +10,6 @@
 */
class BookUninstallValidatorTest extends UnitTestCase {

  use AssertHelperTrait;

  /**
   * @var \Drupal\book\BookUninstallValidator|\PHPUnit\Framework\MockObject\MockObject
   */
@@ -42,7 +39,7 @@ public function testValidateNotBook() {
    $module = 'not_book';
    $expected = [];
    $reasons = $this->bookUninstallValidator->validate($module);
    $this->assertSame($expected, $this->castSafeStrings($reasons));
    $this->assertEquals($expected, $reasons);
  }

  /**
@@ -59,7 +56,7 @@ public function testValidateEntityQueryWithoutResults() {
    $module = 'book';
    $expected = [];
    $reasons = $this->bookUninstallValidator->validate($module);
    $this->assertSame($expected, $this->castSafeStrings($reasons));
    $this->assertEquals($expected, $reasons);
  }

  /**
@@ -76,7 +73,7 @@ public function testValidateEntityQueryWithResults() {
    $module = 'book';
    $expected = ['To uninstall Book, delete all content that has the Book content type'];
    $reasons = $this->bookUninstallValidator->validate($module);
    $this->assertSame($expected, $this->castSafeStrings($reasons));
    $this->assertEquals($expected, $reasons);
  }

  /**
@@ -92,7 +89,7 @@ public function testValidateOutlineStorage() {
    $module = 'book';
    $expected = ['To uninstall Book, delete all content that is part of a book'];
    $reasons = $this->bookUninstallValidator->validate($module);
    $this->assertSame($expected, $this->castSafeStrings($reasons));
    $this->assertEquals($expected, $reasons);
  }

}
+1 −1
Changes for core/modules/breakpoint/tests/src/Kernel/BreakpointDiscoveryTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -192,7 +192,7 @@ public function testBreakpointGroups() {
    ];
    $breakpoint_groups = \Drupal::service('breakpoint.manager')->getGroups();
    // Ensure the order is as expected. Should be sorted by label.
    $this->assertIdentical($expected, $this->castSafeStrings($breakpoint_groups));
    $this->assertEquals($expected, $breakpoint_groups);

    $expected = [
      'breakpoint_theme_test' => 'theme',
+2 −2
Changes for core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ public function testExistingFormat() {
      ],
      'plugins' => ['language' => ['language_list' => 'un']],
    ];
    $this->assertIdentical($this->castSafeStrings($ckeditor->getDefaultSettings()), $expected_default_settings);
    $this->assertEquals($expected_default_settings, $ckeditor->getDefaultSettings());

    // Keep the "CKEditor" editor selected and click the "Configure" button.
    $this->drupalPostForm(NULL, $edit, 'editor_configure');
@@ -300,7 +300,7 @@ public function testNewFormat() {
    $expected_settings['plugins']['stylescombo']['styles'] = '';
    $editor = Editor::load('amazing_format');
    $this->assertInstanceOf(Editor::class, $editor);
    $this->assertEqual($this->castSafeStrings($expected_settings), $this->castSafeStrings($editor->getSettings()), 'The Editor config entity has the correct settings.');
    $this->assertEquals($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');
  }

}
+4 −4
Changes for core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -119,14 +119,14 @@ public function testLoading() {
        'filtered_html' => [
          'format' => 'filtered_html',
          'editor' => 'ckeditor',
          'editorSettings' => $this->castSafeStrings($ckeditor_plugin->getJSSettings($editor)),
          'editorSettings' => $ckeditor_plugin->getJSSettings($editor),
          'editorSupportsContentFiltering' => TRUE,
          'isXssSafe' => FALSE,
        ],
      ],
    ];
    $this->assertTrue($editor_settings_present, "Text Editor module's JavaScript settings are on the page.");
    $this->assertIdentical($expected, $this->castSafeStrings($settings['editor']), "Text Editor module's JavaScript settings on the page are correct.");
    $this->assertEquals($expected, $settings['editor'], "Text Editor module's JavaScript settings on the page are correct.");
    $this->assertTrue($editor_js_present, 'Text Editor JavaScript is present.');
    $this->assertCount(1, $body, 'A body field exists.');
    $this->assertCount(1, $format_selector, 'A single text format selector exists on the page.');
@@ -152,14 +152,14 @@ public function testLoading() {
        'filtered_html' => [
          'format' => 'filtered_html',
          'editor' => 'ckeditor',
          'editorSettings' => $this->castSafeStrings($ckeditor_plugin->getJSSettings($editor)),
          'editorSettings' => $ckeditor_plugin->getJSSettings($editor),
          'editorSupportsContentFiltering' => TRUE,
          'isXssSafe' => FALSE,
        ],
      ],
    ];
    $this->assertTrue($editor_settings_present, "Text Editor module's JavaScript settings are on the page.");
    $this->assertIdentical($expected, $this->castSafeStrings($settings['editor']), "Text Editor module's JavaScript settings on the page are correct.");
    $this->assertEquals($expected, $settings['editor'], "Text Editor module's JavaScript settings on the page are correct.");
    $this->assertTrue($editor_js_present, 'Text Editor JavaScript is present.');
    $this->assertContains('ckeditor/drupal.ckeditor', explode(',', $settings['ajaxPageState']['libraries']), 'CKEditor glue library is present.');

Loading