function UpdateLobTest::testUpdateNullBlob
Tests that we can update a blob column to null.
File
- 
              core/tests/ Drupal/ KernelTests/ Core/ Database/ UpdateLobTest.php, line 37 
Class
- UpdateLobTest
- Tests the Update query builder with LOB fields.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testUpdateNullBlob() {
  $id = $this->connection
    ->insert('test_one_blob')
    ->fields([
    'blob1' => 'test',
  ])
    ->execute();
  $r = $this->connection
    ->query('SELECT * FROM {test_one_blob} WHERE [id] = :id', [
    ':id' => $id,
  ])
    ->fetchAssoc();
  $this->assertSame('test', $r['blob1']);
  $this->connection
    ->update('test_one_blob')
    ->fields([
    'blob1' => NULL,
  ])
    ->condition('id', $id)
    ->execute();
  $r = $this->connection
    ->query('SELECT * FROM {test_one_blob} WHERE [id] = :id', [
    ':id' => $id,
  ])
    ->fetchAssoc();
  $this->assertNull($r['blob1']);
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
