function AssetOptimizationTest::replaceGroupHash

Same name in other branches
  1. 11.x core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationTest.php \Drupal\FunctionalTests\Asset\AssetOptimizationTest::replaceGroupHash()

Replaces the group hash in the given URL.

Parameters

string $url: The source URL.

Return value

string The URL with the group hash replaced.

6 calls to AssetOptimizationTest::replaceGroupHash()
AssetOptimizationTest::assertInvalidAggregates in core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationTest.php
Asserts the aggregate when it is invalid.
AssetOptimizationTest::invalidExclude in core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationTest.php
Adds an invalid 'exclude' query parameter with an invalid value.
AssetOptimizationTest::invalidInclude in core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationTest.php
Replaces the 'include' query parameter with an invalid value.
AssetOptimizationTest::omitInclude in core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationTest.php
Removes the 'include' query parameter from the given URL.
AssetOptimizationTest::omitTheme in core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationTest.php
Removes the 'theme' query parameter from the given URL.

... See full list

File

core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationTest.php, line 223

Class

AssetOptimizationTest
Tests asset aggregation.

Namespace

Drupal\FunctionalTests\Asset

Code

protected function replaceGroupHash(string $url) : string {
    $parts = explode('_', $url, 2);
    $hash = strtok($parts[1], '.');
    $parts[1] = str_replace($hash, 'abcdefghijklmnop', $parts[1]);
    return $this->getAbsoluteUrl(implode('_', $parts));
}

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