You are here

public function DeleteTruncateTest::testDeleteFromNonExistingTable in Drupal 9

Deleting from a not existing table throws a DatabaseExceptionWrapper.

File

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

Class

DeleteTruncateTest
Tests delete and truncate queries.

Namespace

Drupal\KernelTests\Core\Database

Code

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