You are here

function UpdateLobTest::testUpdateMultipleBlob in Zircon Profile 8

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

Confirms that we can update two blob columns in the same table.

File

core/modules/system/src/Tests/Database/UpdateLobTest.php, line 40
Contains \Drupal\system\Tests\Database\UpdateLobTest.

Class

UpdateLobTest
Tests the Update query builder with LOB fields.

Namespace

Drupal\system\Tests\Database

Code

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