You are here

public function InsertTest::testSpecialColumnInsert in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Database/InsertTest.php \Drupal\KernelTests\Core\Database\InsertTest::testSpecialColumnInsert()

Tests that we can INSERT INTO a special named column.

File

core/tests/Drupal/KernelTests/Core/Database/InsertTest.php, line 202

Class

InsertTest
Tests the insert builder.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testSpecialColumnInsert() {
  $this->connection
    ->insert('select')
    ->fields([
    'id' => 2,
    'update' => 'Update value 2',
  ])
    ->execute();
  $saved_value = $this->connection
    ->query('SELECT [update] FROM {select} WHERE [id] = :id', [
    ':id' => 2,
  ])
    ->fetchField();
  $this
    ->assertEquals('Update value 2', $saved_value);
}