function FormCacheTest::setUpMockFormStateCacheStore

Reinitializes the form state cache store as a mock object.

7 calls to FormCacheTest::setUpMockFormStateCacheStore()
FormCacheTest::testDeleteCache in core/tests/Drupal/Tests/Core/Form/FormCacheTest.php
Tests delete cache.
FormCacheTest::testLoadCachedFormState in core/tests/Drupal/Tests/Core/Form/FormCacheTest.php
Tests load cached form state.
FormCacheTest::testLoadCachedFormStateWithFiles in core/tests/Drupal/Tests/Core/Form/FormCacheTest.php
Tests load cached form state with files.
FormCacheTest::testSetCacheAuthUser in core/tests/Drupal/Tests/Core/Form/FormCacheTest.php
Tests set cache auth user.
FormCacheTest::testSetCacheBuildIdMismatch in core/tests/Drupal/Tests/Core/Form/FormCacheTest.php
Tests set cache build id mismatch.

... See full list

File

core/tests/Drupal/Tests/Core/Form/FormCacheTest.php, line 144

Class

FormCacheTest
Tests Drupal\Core\Form\FormCache.

Namespace

Drupal\Tests\Core\Form

Code

protected function setUpMockFormStateCacheStore() : void {
  $this->formStateCacheStore = $this->createMock(KeyValueStoreExpirableInterface::class);
  $reflection = new \ReflectionProperty($this->keyValueExpirableFactory, 'stores');
  $value = $reflection->getValue($this->keyValueExpirableFactory);
  $value['form_state'] = $this->formStateCacheStore;
  $reflection->setValue($this->keyValueExpirableFactory, $value);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.