function MergeTest::getLoggedQueries

Executes a merge-like callback and returns the logged queries.

4 calls to MergeTest::getLoggedQueries()
MergeTest::testMergeExecutesSingleStatement in core/modules/pgsql/tests/src/Kernel/pgsql/MergeTest.php
Tests that a merge executes as a single native MERGE statement.
MergeTest::testMergeMatchedWithoutUpdate in core/modules/pgsql/tests/src/Kernel/pgsql/MergeTest.php
Tests a merge that matches a row but has nothing to update.
MergeTest::testMergeSerialFieldFallback in core/modules/pgsql/tests/src/Kernel/pgsql/MergeTest.php
Tests that inserting into a serial field uses the generic emulation.
MergeTest::testMergeWithoutInsertFieldsFallback in core/modules/pgsql/tests/src/Kernel/pgsql/MergeTest.php
Tests that a merge without insert fields uses the generic emulation.

File

core/modules/pgsql/tests/src/Kernel/pgsql/MergeTest.php, line 29

Class

MergeTest
Tests the native MERGE implementation of the PostgreSQL driver.

Namespace

Drupal\Tests\pgsql\Kernel\pgsql

Code

protected function getLoggedQueries(callable $callback) : array {
  // Warm the table information cache outside of the logged region, so the
  // log contains only the queries of the merge itself.
  $this->connection
    ->schema()
    ->queryTableInformation('test_people');
  Database::startLog('merge_test');
  $callback();
  $queries = Database::getLog('merge_test');
  return array_column($queries, 'query');
}

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