function StateTest::setUp

Overrides UnitTestCase::setUp

File

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

Class

StateTest
@coversDefaultClass \Drupal\Core\State\State @group State

Namespace

Drupal\Tests\Core\State

Code

protected function setUp() : void {
    parent::setUp();
    $this->keyValueStorage = $this->getMockBuilder(KeyValueStoreInterface::class)
        ->getMock();
    $factory = $this->getMockBuilder(KeyValueFactoryInterface::class)
        ->getMock();
    $factory->expects($this->once())
        ->method('get')
        ->with('state')
        ->willReturn($this->keyValueStorage);
    $lock = $this->getMockBuilder(LockBackendInterface::class)
        ->getMock();
    $cache = $this->getMockBuilder(CacheBackendInterface::class)
        ->getMock();
    $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.