function StateTest::testGetMultipleWithMissingValues

Tests getMultiple() method.

Here testing all the keys with value and without values.

@covers ::getMultiple

File

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

Class

StateTest
@coversDefaultClass \Drupal\Core\State\State[[api-linebreak]] @group State

Namespace

Drupal\Tests\Core\State

Code

public function testGetMultipleWithMissingValues() : void {
  $keys = [
    'key1',
    'key2',
    'key3',
  ];
  $values = [
    'key1' => 'value1',
    'key2' => NULL,
    'key3' => NULL,
  ];
  $this->keyValueStorage
    ->expects($this->once())
    ->method('setMultiple')
    ->with($values);
  $this->state
    ->setMultiple($values);
  $this->assertEquals($values, $this->state
    ->getMultiple($keys));
}

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