function StateTest::doSetUpState

Initializes the $state.

2 calls to StateTest::doSetUpState()
StateTest::setUpState in core/tests/Drupal/Tests/Core/State/StateTest.php
Initializes the $state with stub key-value storage.
StateTest::setUpStateWithMockStorage in core/tests/Drupal/Tests/Core/State/StateTest.php
Initializes the $state with mock key-value storage.

File

core/tests/Drupal/Tests/Core/State/StateTest.php, line 54

Class

StateTest
Tests Drupal\Core\State\State.

Namespace

Drupal\Tests\Core\State

Code

protected function doSetUpState() : void {
  $factory = $this->createMock(KeyValueFactoryInterface::class);
  $factory->expects($this->once())
    ->method('get')
    ->with('state')
    ->willReturn($this->keyValueStorage);
  $lock = $this->createStub(LockBackendInterface::class);
  $cache = $this->createStub(CacheBackendInterface::class);
  $this->state = new State($factory, $cache, $lock);
}

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