function ChainedPlaceholderStrategyTest::testProcessPlaceholdersNoStrategies

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php \Drupal\Tests\Core\Render\Placeholder\ChainedPlaceholderStrategyTest::testProcessPlaceholdersNoStrategies()
  2. 10 core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php \Drupal\Tests\Core\Render\Placeholder\ChainedPlaceholderStrategyTest::testProcessPlaceholdersNoStrategies()
  3. 11.x core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php \Drupal\Tests\Core\Render\Placeholder\ChainedPlaceholderStrategyTest::testProcessPlaceholdersNoStrategies()

@covers ::processPlaceholders

File

core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php, line 124

Class

ChainedPlaceholderStrategyTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Render%21Placeholder%21ChainedPlaceholderStrategy.php/class/ChainedPlaceholderStrategy/9" title="Renders placeholders using a chain of placeholder strategies." class="local">\Drupal\Core\Render\Placeholder\ChainedPlaceholderStrategy</a> @group Render

Namespace

Drupal\Tests\Core\Render\Placeholder

Code

public function testProcessPlaceholdersNoStrategies() {
    // Placeholders but no strategies defined.
    $placeholders = [
        'assert-me' => [
            '#markup' => 'I-am-a-llama-that-will-lead-to-an-assertion-by-the-chained-placeholder-strategy.',
        ],
    ];
    $chained_placeholder_strategy = new ChainedPlaceholderStrategy();
    $this->expectException(\AssertionError::class);
    $this->expectExceptionMessage('At least one placeholder strategy must be present; by default the fallback strategy \\Drupal\\Core\\Render\\Placeholder\\SingleFlushStrategy is always present.');
    $chained_placeholder_strategy->processPlaceholders($placeholders);
}

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