public function DatabaseStorageSortedTestBase::assertPairs in Key-value Extensions 8
2 calls to DatabaseStorageSortedTestBase::assertPairs()
File
- src/
Tests/ DatabaseStorageSortedTestBase.php, line 40
Class
Namespace
Drupal\key_value\TestsCode
public function assertPairs($expected_pairs) {
$result = $this->connection
->select('key_value_sorted', 't')
->fields('t', [
'name',
'value',
])
->condition('collection', $this->collection)
->condition('name', array_keys($expected_pairs), 'IN')
->execute()
->fetchAllAssoc('name');
$expected_count = count($expected_pairs);
$this
->assertIdentical(count($result), $expected_count, "Query affected {$expected_count} records.");
foreach ($expected_pairs as $key => $value) {
$this
->assertIdentical($this->serializer
->decode($result[$key]->value), $value, "Key {$key} have value {$value}");
}
}