You are here

public function InsertLobTest::testInsertNullBlob in Drupal 9

Tests that we can insert a null into blob field.

File

core/tests/Drupal/KernelTests/Core/Database/InsertLobTest.php, line 30

Class

InsertLobTest
Tests the Insert query builder with LOB fields.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testInsertNullBlob() {
  $id = $this->connection
    ->insert('test_one_blob')
    ->fields([
    'blob1' => NULL,
  ])
    ->execute();
  $r = $this->connection
    ->query('SELECT * FROM {test_one_blob} WHERE [id] = :id', [
    ':id' => $id,
  ])
    ->fetchAssoc();
  $this
    ->assertNull($r['blob1']);
}