public function TwigMarkupInterfaceTest::providerTestMarkupInterfaceEmpty in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Theme/TwigMarkupInterfaceTest.php \Drupal\KernelTests\Core\Theme\TwigMarkupInterfaceTest::providerTestMarkupInterfaceEmpty()
- 9 core/tests/Drupal/KernelTests/Core/Theme/TwigMarkupInterfaceTest.php \Drupal\KernelTests\Core\Theme\TwigMarkupInterfaceTest::providerTestMarkupInterfaceEmpty()
Provide test examples.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Theme/ TwigMarkupInterfaceTest.php, line 46 - Contains \Drupal\KernelTests\Core\Theme\TwigMarkupInterfaceTest.
Class
- TwigMarkupInterfaceTest
- Tests Twig with MarkupInterface objects.
Namespace
Drupal\KernelTests\Core\ThemeCode
public function providerTestMarkupInterfaceEmpty() {
return [
// The first argument to \Drupal\Core\StringTranslation\TranslatableMarkup
// is not supposed to be an empty string.
// phpcs:ignore Drupal.Semantics.FunctionT.EmptyString
'empty TranslatableMarkup' => [
'',
new TranslatableMarkup(''),
],
'non-empty TranslatableMarkup' => [
'<span>test</span>',
new TranslatableMarkup('test'),
],
'empty FormattableMarkup' => [
'',
new FormattableMarkup('', [
'@foo' => 'bar',
]),
],
'non-empty FormattableMarkup' => [
'<span>bar</span>',
new FormattableMarkup('@foo', [
'@foo' => 'bar',
]),
],
'non-empty Markup' => [
'<span>test</span>',
Markup::create('test'),
],
'empty GeneratedLink' => [
'',
new GeneratedLink(),
],
'non-empty GeneratedLink' => [
'<span><a hef="http://www.example.com">test</a></span>',
(new GeneratedLink())
->setGeneratedLink('<a hef="http://www.example.com">test</a>'),
],
// Test objects that do not implement \Countable.
'empty SafeMarkupTestMarkup' => [
'',
SafeMarkupTestMarkup::create(''),
],
'non-empty SafeMarkupTestMarkup' => [
'<span>test</span>',
SafeMarkupTestMarkup::create('test'),
],
];
}