function FormCacheTest::setUp
Same name in this branch
- main core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php \Drupal\KernelTests\Core\Form\FormCacheTest::setUp()
Same name and namespace in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php \Drupal\KernelTests\Core\Form\FormCacheTest::setUp()
- 11.x core/tests/Drupal/Tests/Core/Form/FormCacheTest.php \Drupal\Tests\Core\Form\FormCacheTest::setUp()
- 10 core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php \Drupal\KernelTests\Core\Form\FormCacheTest::setUp()
- 10 core/tests/Drupal/Tests/Core/Form/FormCacheTest.php \Drupal\Tests\Core\Form\FormCacheTest::setUp()
- 9 core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php \Drupal\KernelTests\Core\Form\FormCacheTest::setUp()
- 9 core/tests/Drupal/Tests/Core/Form/FormCacheTest.php \Drupal\Tests\Core\Form\FormCacheTest::setUp()
- 8.9.x core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php \Drupal\KernelTests\Core\Form\FormCacheTest::setUp()
- 8.9.x core/tests/Drupal/Tests/Core/Form/FormCacheTest.php \Drupal\Tests\Core\Form\FormCacheTest::setUp()
Overrides UnitTestCase::setUp
File
-
core/
tests/ Drupal/ Tests/ Core/ Form/ FormCacheTest.php, line 101
Class
Namespace
Drupal\Tests\Core\FormCode
protected function setUp() : void {
parent::setUp();
$this->moduleHandler = $this->prophesize('Drupal\\Core\\Extension\\ModuleHandlerInterface');
$this->formCacheStore = $this->createStub(KeyValueStoreExpirableInterface::class);
$this->formStateCacheStore = $this->createStub(KeyValueStoreExpirableInterface::class);
$this->keyValueExpirableFactory = new KeyValueExpirableFactory(new ContainerBuilder());
// Use reflection to set the factory stores so we avoid dealing with using a
// container.
$reflection = new \ReflectionProperty($this->keyValueExpirableFactory, 'stores');
$reflection->setValue($this->keyValueExpirableFactory, [
'form' => $this->formCacheStore,
'form_state' => $this->formStateCacheStore,
]);
$this->csrfToken = $this->createStub(CsrfTokenGenerator::class);
$this->account = $this->createStub(AccountInterface::class);
$this->logger = $this->createStub(LoggerInterface::class);
$this->requestStack = $this->createStub(RequestStack::class);
$this->requestPolicy = $this->createStub(RequestPolicyInterface::class);
$this->formCache = new FormCache($this->root, $this->keyValueExpirableFactory, $this->moduleHandler
->reveal(), $this->account, $this->csrfToken, $this->logger, $this->requestStack, $this->requestPolicy);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.