protected function AuthcacheFormTestCacheLifespan::assertCachedFormLifespan in Authenticated User Page Caching (Authcache) 7.2
Asserts that the expire date of a cached form is correct.
1 call to AuthcacheFormTestCacheLifespan::assertCachedFormLifespan()
- AuthcacheFormTestCacheLifespan::testCachedFormBuildID in modules/
authcache_form/ tests/ authcache_form.test - Test functionality for form-build-id.
File
- modules/
authcache_form/ tests/ authcache_form.test, line 850 - Test classes for Authcache Form module.
Class
- AuthcacheFormTestCacheLifespan
- Test form extended lifespan.
Code
protected function assertCachedFormLifespan($build_id, $lifespan, $message = NULL) {
$min = REQUEST_TIME + $lifespan;
$max = time() + $lifespan;
$cached_form = cache_get('form_' . $build_id, 'cache_form');
$this
->assert($cached_form->expire >= $min && $cached_form->expire <= $max, format_string('Lifespan of the cached form structure is @lifespan', array(
'@lifespan' => $lifespan,
)));
$cached_form_state = cache_get('form_state_' . $build_id, 'cache_form');
$this
->assert($cached_form_state->expire >= $min && $cached_form_state->expire <= $max, format_string('Lifespan of the form state is @lifespan', array(
'@lifespan' => $lifespan,
)));
}