function AssetOptimizationTest::setInvalidLibrary

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

Replaces the 'include' entry in the given URL with an invalid value.

Parameters

string $url: The source URL.

Return value

string The URL with the 'include' query set to an invalid value.

1 call to AssetOptimizationTest::setInvalidLibrary()
AssetOptimizationTest::assertInvalidAggregates in core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationTest.php
Asserts the aggregate when it is invalid.

File

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

Class

AssetOptimizationTest
Tests asset aggregation.

Namespace

Drupal\FunctionalTests\Asset

Code

protected function setInvalidLibrary(string $url) : string {
    // First replace the hash, so we don't get served the actual file on disk.
    $url = $this->replaceGroupHash($url);
    $parts = UrlHelper::parse($url);
    $include = explode(',', UrlHelper::uncompressQueryParameter($parts['query']['include']));
    $include[] = 'system/llama';
    $parts['query']['include'] = UrlHelper::compressQueryParameter(implode(',', $include));
    $query = UrlHelper::buildQuery($parts['query']);
    return $this->getAbsoluteUrl($parts['path'] . '?' . $query . '#' . $parts['fragment']);
}

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