You are here

protected function EndOfTransactionQueriesTest::getStatementsForTable in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Cache/EndOfTransactionQueriesTest.php \Drupal\KernelTests\Core\Cache\EndOfTransactionQueriesTest::getStatementsForTable()
  2. 10 core/tests/Drupal/KernelTests/Core/Cache/EndOfTransactionQueriesTest.php \Drupal\KernelTests\Core\Cache\EndOfTransactionQueriesTest::getStatementsForTable()

Filters statements by table name.

Parameters

string[] $statements: A list of query statements.

$table_name: The name of the table to filter by.

Return value

string[] Filtered statement list.

1 call to EndOfTransactionQueriesTest::getStatementsForTable()
EndOfTransactionQueriesTest::testEntitySave in core/tests/Drupal/KernelTests/Core/Cache/EndOfTransactionQueriesTest.php

File

core/tests/Drupal/KernelTests/Core/Cache/EndOfTransactionQueriesTest.php, line 150

Class

EndOfTransactionQueriesTest
Tests that cache tag invalidation queries are delayed to the end of transactions.

Namespace

Drupal\KernelTests\Core\Cache

Code

protected function getStatementsForTable(array $statements, $table_name) {
  $tables = array_filter(array_map([
    $this,
    'statementToTableName',
  ], $statements));
  return array_filter($tables, function ($table_for_statement) use ($table_name) {
    return $table_for_statement === $table_name;
  });
}