function AjaxFormCacheTest::testFormCacheUsage
Same name in other branches
- 9 core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormCacheTest.php \Drupal\FunctionalJavascriptTests\Ajax\AjaxFormCacheTest::testFormCacheUsage()
- 8.9.x core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormCacheTest.php \Drupal\FunctionalJavascriptTests\Ajax\AjaxFormCacheTest::testFormCacheUsage()
- 10 core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormCacheTest.php \Drupal\FunctionalJavascriptTests\Ajax\AjaxFormCacheTest::testFormCacheUsage()
Tests the usage of form cache for AJAX forms.
File
-
core/
tests/ Drupal/ FunctionalJavascriptTests/ Ajax/ AjaxFormCacheTest.php, line 30
Class
- AjaxFormCacheTest
- Tests the usage of form caching for AJAX forms.
Namespace
Drupal\FunctionalJavascriptTests\AjaxCode
public function testFormCacheUsage() : void {
/** @var \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface $key_value_expirable */
$key_value_expirable = \Drupal::service('keyvalue.expirable')->get('form');
$this->drupalLogin($this->rootUser);
// Ensure that the cache is empty.
$this->assertCount(0, $key_value_expirable->getAll());
// Visit an AJAX form that is not cached, 3 times.
$uncached_form_url = Url::fromRoute('ajax_forms_test.commands_form');
$this->drupalGet($uncached_form_url);
$this->drupalGet($uncached_form_url);
$this->drupalGet($uncached_form_url);
// The number of cache entries should not have changed.
$this->assertCount(0, $key_value_expirable->getAll());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.