function MarkupInterfaceComparatorTest::dataSetProviderDeprecatedCases

Provides test data for the comparator - deprecated cases.

Return value

array Each array entry has:

  • test expected value,
  • test actual value,
  • a bool indicating the expected return value of ::accepts,
  • a value indicating the expected result of ::assertEquals, TRUE if comparison should match, FALSE if error, or a class name of an object thrown.
  • the expected deprecation message.

File

core/tests/Drupal/KernelTests/Core/Test/Comparator/MarkupInterfaceComparatorTest.php, line 167

Class

MarkupInterfaceComparatorTest
Tests \Drupal\TestTools\Comparator\MarkupInterfaceComparator.

Namespace

Drupal\KernelTests\Core\Test\Comparator

Code

public static function dataSetProviderDeprecatedCases() {
    return [
        'html string with tags vs FormattableMarkup, equal' => [
            '<em class="placeholder">For Your Eyes</em> Only',
            new FormattableMarkup('%placeholder Only', [
                '%placeholder' => 'For Your Eyes',
            ]),
            TRUE,
            TRUE,
            'Using assert[Not]Equals() to compare markup between MarkupInterface objects and plain strings is deprecated in drupal:10.1.0 and will throw an error from drupal:11.0.0. Expected: \'<em class="placeholder">For Your Eyes</em> Only\' - Actual \'<em class="placeholder">For Your Eyes</em> Only\'. Use assert[Not]Same() and cast objects to string instead. See https://www.drupal.org/node/3334057',
        ],
        'html string with tags vs FormattableMarkup, not equal' => [
            '<em class="placeholder">For Your Eyes</em> Too',
            new FormattableMarkup('%placeholder Only', [
                '%placeholder' => 'For Your Eyes',
            ]),
            TRUE,
            FALSE,
            'Using assert[Not]Equals() to compare markup between MarkupInterface objects and plain strings is deprecated in drupal:10.1.0 and will throw an error from drupal:11.0.0. Expected: \'<em class="placeholder">For Your Eyes</em> Too\' - Actual \'<em class="placeholder">For Your Eyes</em> Only\'. Use assert[Not]Same() and cast objects to string instead. See https://www.drupal.org/node/3334057',
        ],
        'FormattableMarkup vs html string with tags, equal' => [
            new FormattableMarkup('%placeholder Only', [
                '%placeholder' => 'For Your Eyes',
            ]),
            '<em class="placeholder">For Your Eyes</em> Only',
            TRUE,
            TRUE,
            'Using assert[Not]Equals() to compare markup between MarkupInterface objects and plain strings is deprecated in drupal:10.1.0 and will throw an error from drupal:11.0.0. Expected: \'<em class="placeholder">For Your Eyes</em> Only\' - Actual \'<em class="placeholder">For Your Eyes</em> Only\'. Use assert[Not]Same() and cast objects to string instead. See https://www.drupal.org/node/3334057',
        ],
        'FormattableMarkup vs html string with tags, not equal' => [
            new FormattableMarkup('%placeholder Only', [
                '%placeholder' => 'For Your Eyes',
            ]),
            '<em class="placeholder">For Your Eyes</em> Too',
            TRUE,
            FALSE,
            'Using assert[Not]Equals() to compare markup between MarkupInterface objects and plain strings is deprecated in drupal:10.1.0 and will throw an error from drupal:11.0.0. Expected: \'<em class="placeholder">For Your Eyes</em> Only\' - Actual \'<em class="placeholder">For Your Eyes</em> Too\'. Use assert[Not]Same() and cast objects to string instead. See https://www.drupal.org/node/3334057',
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.