function FormattableMarkupTest::providerTestUnexpectedPlaceholder

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php \Drupal\Tests\Component\Render\FormattableMarkupTest::providerTestUnexpectedPlaceholder()
  2. 8.9.x core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php \Drupal\Tests\Component\Render\FormattableMarkupTest::providerTestUnexpectedPlaceholder()
  3. 11.x core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php \Drupal\Tests\Component\Render\FormattableMarkupTest::providerTestUnexpectedPlaceholder()

Data provider for
@dataProvider providerTestUnexpectedPlaceholder" class="local">FormattableMarkupTest::testUnexpectedPlaceholder
().

Return value

array

File

core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php, line 120

Class

FormattableMarkupTest
Tests the TranslatableMarkup class.

Namespace

Drupal\Tests\Component\Render

Code

public static function providerTestUnexpectedPlaceholder() {
  return [
    [
      'Non alpha, non-allowed starting character: ~placeholder',
      [
        '~placeholder' => 'replaced',
      ],
      E_USER_WARNING,
      'Placeholders must begin with one of the following "@", ":" or "%", invalid placeholder (~placeholder) with string: "Non alpha, non-allowed starting character: ~placeholder"',
    ],
    [
      'Alpha starting character: placeholder',
      [
        'placeholder' => 'replaced',
      ],
      NULL,
      '',
    ],
    // Ensure that where the placeholder is located in the string is
    // irrelevant.
[
      'placeholder',
      [
        'placeholder' => 'replaced',
      ],
      NULL,
      '',
    ],
    [
      'No replacements',
      [
        'foo' => 'bar',
      ],
      NULL,
      '',
    ],
  ];
}

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