function StateTest::testGetMultiple

Tests getMultiple() method.

Here checking the multiple key and values. It is also a helper for testGetMultipleStaticCache() function.

@covers ::getMultiple

File

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

Class

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

Namespace

Drupal\Tests\Core\State

Code

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

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