function AssetOptimizationTest::assertInvalidAggregates
Same name in other branches
- 11.x core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationTest.php \Drupal\FunctionalTests\Asset\AssetOptimizationTest::assertInvalidAggregates()
Asserts the aggregate when it is invalid.
Parameters
string $url: The source URL.
Throws
\Behat\Mink\Exception\ExpectationException
1 call to AssetOptimizationTest::assertInvalidAggregates()
- AssetOptimizationTest::doTestAggregation in core/
tests/ Drupal/ FunctionalTests/ Asset/ AssetOptimizationTest.php - Helper to test aggregate file URLs.
File
-
core/
tests/ Drupal/ FunctionalTests/ Asset/ AssetOptimizationTest.php, line 162
Class
- AssetOptimizationTest
- Tests asset aggregation.
Namespace
Drupal\FunctionalTests\AssetCode
protected function assertInvalidAggregates(string $url) : void {
$url = $this->getAbsoluteUrl($url);
// Not every script or style on a page is aggregated.
if (!str_contains($url, $this->fileAssetsPath)) {
return;
}
$session = $this->getSession();
$session->visit($this->replaceGroupDelta($url));
$this->assertSession()
->statusCodeEquals(200);
$session->visit($this->omitTheme($url));
$this->assertSession()
->statusCodeEquals(400);
$session->visit($this->omitInclude($url));
$this->assertSession()
->statusCodeEquals(400);
$session->visit($this->invalidInclude($url));
$this->assertSession()
->statusCodeEquals(400);
$session->visit($this->invalidExclude($url));
$this->assertSession()
->statusCodeEquals(400);
$session->visit($this->replaceFileNamePrefix($url));
$this->assertSession()
->statusCodeEquals(400);
$session->visit($this->setInvalidLibrary($url));
$this->assertSession()
->statusCodeEquals(200);
// When an invalid asset hash name is given.
$session->visit($this->replaceGroupHash($url));
$this->assertSession()
->statusCodeEquals(200);
$current_url = $session->getCurrentUrl();
// Redirect to the correct one.
$this->assertEquals($url, $current_url);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.