You are here

public function UpdateTest::testUpdateNonExistingTable in Drupal 9

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