You are here

function InsertLobTest::testInsertMultipleBlob in Zircon Profile 8

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

Tests that we can insert multiple blob fields in the same query.

File

core/modules/system/src/Tests/Database/InsertLobTest.php, line 33
Contains \Drupal\system\Tests\Database\InsertLobTest.

Class

InsertLobTest
Tests the Insert query builder with LOB fields.

Namespace

Drupal\system\Tests\Database

Code

function testInsertMultipleBlob() {
  $id = db_insert('test_two_blobs')
    ->fields(array(
    'blob1' => 'This is',
    'blob2' => 'a test',
  ))
    ->execute();
  $r = db_query('SELECT * FROM {test_two_blobs} WHERE id = :id', array(
    ':id' => $id,
  ))
    ->fetchAssoc();
  $this
    ->assertTrue($r['blob1'] === 'This is' && $r['blob2'] === 'a test', 'Can insert multiple blobs per row.');
}