You are here

public function UpdateTest::testUpdateValueInSerial in Drupal 9

Updating a serial field throws a IntegrityConstraintViolationException.

File

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

Class

UpdateTest
Tests the update query builder.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testUpdateValueInSerial() : void {
  $this
    ->expectException(IntegrityConstraintViolationException::class);
  $this->connection
    ->update('test')
    ->fields([
    'id' => 2,
  ])
    ->condition('id', 1)
    ->execute();
}