function AssetOptimizationTest::invalidCategory

Replaces the 'category' query parameter with an invalid value.

Parameters

string $url: The source URL.

Return value

string The URL with 'category' set to an arbitrary string.

File

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

Class

AssetOptimizationTest
Tests asset aggregation.

Namespace

Drupal\FunctionalTests\Asset

Code

protected function invalidCategory(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);
  $parts['query']['category'] = 'abcdefghijklmnop';
  $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.