function UpdateTest::testUpdateNonExistingTable

Same name in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Database/UpdateTest.php \Drupal\KernelTests\Core\Database\UpdateTest::testUpdateNonExistingTable()
  2. 11.x core/tests/Drupal/KernelTests/Core/Database/UpdateTest.php \Drupal\KernelTests\Core\Database\UpdateTest::testUpdateNonExistingTable()

Updating a not existing table throws a DatabaseExceptionWrapper.

File

core/tests/Drupal/KernelTests/Core/Database/UpdateTest.php, line 152

Class

UpdateTest
Tests the update query builder.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testUpdateNonExistingTable() : void {
    $this->expectException(DatabaseExceptionWrapper::class);
    $this->connection
        ->update('a-table-that-does-not-exist')
        ->fields([
        'update' => 'New update value',
    ])
        ->condition('id', 1)
        ->execute();
}

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