function ChainedPlaceholderStrategyTest::testProcessPlaceholdersWithRoguePlaceholderStrategy
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php \Drupal\Tests\Core\Render\Placeholder\ChainedPlaceholderStrategyTest::testProcessPlaceholdersWithRoguePlaceholderStrategy()
- 10 core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php \Drupal\Tests\Core\Render\Placeholder\ChainedPlaceholderStrategyTest::testProcessPlaceholdersWithRoguePlaceholderStrategy()
- 11.x core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php \Drupal\Tests\Core\Render\Placeholder\ChainedPlaceholderStrategyTest::testProcessPlaceholdersWithRoguePlaceholderStrategy()
@covers ::processPlaceholders
File
-
core/
tests/ Drupal/ Tests/ Core/ Render/ Placeholder/ ChainedPlaceholderStrategyTest.php, line 139
Class
- ChainedPlaceholderStrategyTest
- @coversDefaultClass \Drupal\Core\Render\Placeholder\ChainedPlaceholderStrategy @group Render
Namespace
Drupal\Tests\Core\Render\PlaceholderCode
public function testProcessPlaceholdersWithRoguePlaceholderStrategy() {
// Placeholders but no strategies defined.
$placeholders = [
'assert-me' => [
'#markup' => 'llama',
],
];
$result = [
'assert-me' => [
'#markup' => 'llama',
],
'new-placeholder' => [
'#markup' => 'rogue llama',
],
];
$prophecy = $this->prophesize('\\Drupal\\Core\\Render\\Placeholder\\PlaceholderStrategyInterface');
$prophecy->processPlaceholders($placeholders)
->willReturn($result);
$rogue_strategy = $prophecy->reveal();
$chained_placeholder_strategy = new ChainedPlaceholderStrategy();
$chained_placeholder_strategy->addPlaceholderStrategy($rogue_strategy);
$this->expectException(\AssertionError::class);
$this->expectExceptionMessage('Processed placeholders must be a subset of all placeholders.');
$chained_placeholder_strategy->processPlaceholders($placeholders);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.