public function FeatureContext::pageIsCaching in Pantheon Advanced Page Cache 8
@Given :page is caching
File
- tests/
behat/ helper_classes/ Contexts/ FeatureContext.php, line 84
Class
- FeatureContext
- Define application features from the specific context.
Namespace
PantheonSystems\CDNBehatHelpers\ContextsCode
public function pageIsCaching($page) {
$age = $this
->getAge($page);
// A zero age doesn't necessarily mean the page is not caching.
// A second request may show a higher age.
if (!empty($age)) {
return true;
}
else {
sleep(2);
$age = $this
->getAge($page);
if (empty($age)) {
throw new \Exception('not cached');
}
else {
return true;
}
}
}