You are here

protected function FormCacheTest::setUp in Zircon Profile 8

Same name in this branch
  1. 8 core/tests/Drupal/Tests/Core/Form/FormCacheTest.php \Drupal\Tests\Core\Form\FormCacheTest::setUp()
  2. 8 core/modules/system/src/Tests/Form/FormCacheTest.php \Drupal\system\Tests\Form\FormCacheTest::setUp()
Same name and namespace in other branches
  1. 8.0 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 95
Contains \Drupal\Tests\Core\Form\FormCacheTest.

Class

FormCacheTest
@coversDefaultClass \Drupal\Core\Form\FormCache @group Form @runTestsInSeparateProcesses @preserveGlobalState disabled

Namespace

Drupal\Tests\Core\Form

Code

protected function setUp() {
  parent::setUp();
  $this->moduleHandler = $this
    ->getMock('Drupal\\Core\\Extension\\ModuleHandlerInterface');
  $this->formCacheStore = $this
    ->getMock('Drupal\\Core\\KeyValueStore\\KeyValueStoreExpirableInterface');
  $this->formStateCacheStore = $this
    ->getMock('Drupal\\Core\\KeyValueStore\\KeyValueStoreExpirableInterface');
  $this->keyValueExpirableFactory = $this
    ->getMock('Drupal\\Core\\KeyValueStore\\KeyValueExpirableFactoryInterface');
  $this->keyValueExpirableFactory
    ->expects($this
    ->any())
    ->method('get')
    ->will($this
    ->returnValueMap([
    [
      'form',
      $this->formCacheStore,
    ],
    [
      'form_state',
      $this->formStateCacheStore,
    ],
  ]));
  $this->csrfToken = $this
    ->getMockBuilder('Drupal\\Core\\Access\\CsrfTokenGenerator')
    ->disableOriginalConstructor()
    ->getMock();
  $this->account = $this
    ->getMock('Drupal\\Core\\Session\\AccountInterface');
  $this->logger = $this
    ->getMock('Psr\\Log\\LoggerInterface');
  $this->requestStack = $this
    ->getMock('\\Symfony\\Component\\HttpFoundation\\RequestStack');
  $this->requestPolicy = $this
    ->getMock('\\Drupal\\Core\\PageCache\\RequestPolicyInterface');
  $this->formCache = new FormCache($this->root, $this->keyValueExpirableFactory, $this->moduleHandler, $this->account, $this->csrfToken, $this->logger, $this->requestStack, $this->requestPolicy);
}