public function UpdateTest::testPrimaryKeyUpdate in Drupal driver for SQL Server and SQL Azure 4.0.x
Same name and namespace in other branches
- 8.2 tests/src/Kernel/UpdateTest.php \Drupal\Tests\sqlsrv\Kernel\UpdateTest::testPrimaryKeyUpdate()
- 4.2.x tests/src/Kernel/UpdateTest.php \Drupal\Tests\sqlsrv\Kernel\UpdateTest::testPrimaryKeyUpdate()
- 3.0.x tests/src/Kernel/UpdateTest.php \Drupal\Tests\sqlsrv\Kernel\UpdateTest::testPrimaryKeyUpdate()
- 3.1.x tests/src/Kernel/UpdateTest.php \Drupal\Tests\sqlsrv\Kernel\UpdateTest::testPrimaryKeyUpdate()
- 4.1.x tests/src/Kernel/UpdateTest.php \Drupal\Tests\sqlsrv\Kernel\UpdateTest::testPrimaryKeyUpdate()
Expect an exception when updating a primary key.
File
- tests/
src/ Kernel/ UpdateTest.php, line 17
Class
- UpdateTest
- Tests the update query builder.
Namespace
Drupal\Tests\sqlsrv\KernelCode
public function testPrimaryKeyUpdate() {
$this
->expectException(\Exception::class);
$num_updated = $this->connection
->update('test')
->fields([
'id' => 42,
'name' => 'John',
])
->condition('id', '1')
->execute();
}