function FormCacheTest::setUpMockCsrfTokenGenerator

Reinitializes the CSRF token generator as a mock object.

4 calls to FormCacheTest::setUpMockCsrfTokenGenerator()
FormCacheTest::testGetCacheAnonUser in core/tests/Drupal/Tests/Core/Form/FormCacheTest.php
Tests get cache anon user.
FormCacheTest::testGetCacheInvalidToken in core/tests/Drupal/Tests/Core/Form/FormCacheTest.php
Tests get cache invalid token.
FormCacheTest::testGetCacheValidToken in core/tests/Drupal/Tests/Core/Form/FormCacheTest.php
Tests get cache valid token.
FormCacheTest::testSetCacheAuthUser in core/tests/Drupal/Tests/Core/Form/FormCacheTest.php
Tests set cache auth user.

File

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

Class

FormCacheTest
Tests Drupal\Core\Form\FormCache.

Namespace

Drupal\Tests\Core\Form

Code

protected function setUpMockCsrfTokenGenerator() : void {
  $this->csrfToken = $this->createMock(CsrfTokenGenerator::class);
  $reflection = new \ReflectionProperty($this->formCache, 'csrfToken');
  $reflection->setValue($this->formCache, $this->csrfToken);
}

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