public function TokenTest::providerTestReplaceEscaping in Drupal 10        
                          
                  
                        Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Utility/TokenTest.php \Drupal\Tests\Core\Utility\TokenTest::providerTestReplaceEscaping()
- 9 core/tests/Drupal/Tests/Core/Utility/TokenTest.php \Drupal\Tests\Core\Utility\TokenTest::providerTestReplaceEscaping()
File
 
   - core/tests/Drupal/Tests/Core/Utility/TokenTest.php, line 278
Class
  
  - TokenTest 
- @coversDefaultClass \Drupal\Core\Utility\Token
@group Utility
Namespace
  Drupal\Tests\Core\Utility
Code
public function providerTestReplaceEscaping() {
  $data = [];
  
  $data['no-tokens'] = [
    'muh',
    [],
    'muh',
  ];
  $data['html-in-string'] = [
    '<h1>Giraffe</h1>',
    [],
    '<h1>Giraffe</h1>',
  ];
  $data['html-in-string-quote'] = [
    '<h1>Giraffe"</h1>',
    [],
    '<h1>Giraffe"</h1>',
  ];
  $data['simple-placeholder-with-plain-text'] = [
    '<h1>[token:meh]</h1>',
    [
      '[token:meh]' => 'Giraffe"',
    ],
    '<h1>' . Html::escape('Giraffe"') . '</h1>',
  ];
  $data['simple-placeholder-with-safe-html'] = [
    '<h1>[token:meh]</h1>',
    [
      '[token:meh]' => Markup::create('<em>Emphasized</em>'),
    ],
    '<h1><em>Emphasized</em></h1>',
  ];
  return $data;
}