function StateTest::testGetStaticCache
Tests both get() & getMultiple() method.
Here with the help of testGet() function, testing the key value again.
@covers ::get @covers ::getMultiple
@depends testGet
File
-
core/
tests/ Drupal/ Tests/ Core/ State/ StateTest.php, line 117
Class
- StateTest
- @coversDefaultClass \Drupal\Core\State\State @group State
Namespace
Drupal\Tests\Core\StateCode
public function testGetStaticCache(State $state) : void {
$this->keyValueStorage
->expects($this->never())
->method('getMultiple');
$this->assertEquals('the-value', $state->get('existing'));
$this->assertEquals('the-value-2', $state->get('default-value', 'default'));
$this->assertEquals([
"existing" => "the-value",
], $state->getMultiple([
'existing',
]));
$this->assertEquals([
"default-value" => "the-value-2",
"default" => NULL,
], $state->getMultiple([
'default-value',
'default',
]));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.