function UpdateTest::testUpdateValueInSerial

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

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

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