function DeleteTruncateTest::testDeleteFromNonExistingTable

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Database/DeleteTruncateTest.php \Drupal\KernelTests\Core\Database\DeleteTruncateTest::testDeleteFromNonExistingTable()
  2. 11.x core/tests/Drupal/KernelTests/Core/Database/DeleteTruncateTest.php \Drupal\KernelTests\Core\Database\DeleteTruncateTest::testDeleteFromNonExistingTable()

Deleting from a not existing table throws a DatabaseExceptionWrapper.

File

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

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();
}

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