public function UpsertTest::testUpsertNonExistingTable in Drupal 9
Upsert on a not existing table throws a DatabaseExceptionWrapper.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Database/ UpsertTest.php, line 113
Class
- UpsertTest
- Tests the Upsert query builder.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testUpsertNonExistingTable() : void {
$this
->expectException(DatabaseExceptionWrapper::class);
$upsert = $this->connection
->upsert('a-table-that-does-not-exist')
->key('id')
->fields([
'id',
'update',
]);
$upsert
->values([
'id' => 1,
'update' => 'Update value 1 updated',
]);
$upsert
->execute();
}