function StateTest::testDeleteAfterGet
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/State/StateTest.php \Drupal\Tests\Core\State\StateTest::testDeleteAfterGet()
Tests both get() & delete() method.
Here testing the key and value after deleting the key's value.
Ensure that deleting clears some static cache.
@legacy-covers ::get @legacy-covers ::delete
File
-
core/
tests/ Drupal/ Tests/ Core/ State/ StateTest.php, line 315
Class
- StateTest
- Tests Drupal\Core\State\State.
Namespace
Drupal\Tests\Core\StateCode
public function testDeleteAfterGet() : void {
$values = [
'key' => 'value',
];
$this->keyValueStorage
->expects($this->once())
->method('setMultiple')
->with($values);
$this->state
->setMultiple($values);
$this->assertEquals('value', $this->state
->get('key'));
$this->state
->delete('key');
$this->assertEquals(NULL, $this->state
->get('key'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.