function StateTest::testGetMultiplePartiallyFilledStaticCache

Tests getMultiple() method.

Here testing the multiple key value pare with Partially Filled Static Cache.

@covers ::getMultiple

File

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

Class

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

Namespace

Drupal\Tests\Core\State

Code

public function testGetMultiplePartiallyFilledStaticCache() : void {
    $keys = [
        'key1',
        'key2',
        'key3',
    ];
    $values = [
        'key1' => 'value1',
        'key2' => 'value2',
        'key3' => 'value3',
    ];
    $this->keyValueStorage
        ->expects($this->once())
        ->method('setMultiple')
        ->with($values + [
        'key4' => 'value4',
    ]);
    $this->state
        ->setMultiple($values + [
        'key4' => 'value4',
    ]);
    $new_keys = array_merge($keys, [
        'key4',
    ]);
    $new_values = array_merge($values, [
        'key4' => 'value4',
    ]);
    $this->assertEquals($values, $this->state
        ->getMultiple($keys));
    $this->assertEquals($new_values, $this->state
        ->getMultiple($new_keys));
}

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