function DeleteTruncateTest::testTruncateNonExistingTable

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

Truncating a not existing table throws a DatabaseExceptionWrapper.

File

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

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

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