You are here

public function DeleteTruncateTest::testTruncateNonExistingTable in Drupal 9

Truncating a not existing table throws a DatabaseExceptionWrapper.

File

core/tests/Drupal/KernelTests/Core/Database/DeleteTruncateTest.php, line 165

Class

DeleteTruncateTest
Tests delete and truncate queries.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testTruncateNonExistingTable() : void {
  $this
    ->expectException(DatabaseExceptionWrapper::class);
  $this->connection
    ->truncate('a-table-that-does-not-exist')
    ->execute();
}