You are here

function InsertTest::testSpecialColumnInsert in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Database/InsertTest.php \Drupal\system\Tests\Database\InsertTest::testSpecialColumnInsert()

Tests that we can INSERT INTO a special named column.

File

core/modules/system/src/Tests/Database/InsertTest.php, line 188
Contains \Drupal\system\Tests\Database\InsertTest.

Class

InsertTest
Tests the insert builder.

Namespace

Drupal\system\Tests\Database

Code

function testSpecialColumnInsert() {
  $id = db_insert('test_special_columns')
    ->fields(array(
    'id' => 2,
    'offset' => 'Offset value 2',
  ))
    ->execute();
  $saved_value = db_query('SELECT "offset" FROM {test_special_columns} WHERE id = :id', array(
    ':id' => 2,
  ))
    ->fetchField();
  $this
    ->assertIdentical($saved_value, 'Offset value 2', 'Can retrieve special column name value after inserting.');
}