function InsertLobTest::testInsertNullBlob

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Database/InsertLobTest.php \Drupal\KernelTests\Core\Database\InsertLobTest::testInsertNullBlob()
  2. 11.x core/tests/Drupal/KernelTests/Core/Database/InsertLobTest.php \Drupal\KernelTests\Core\Database\InsertLobTest::testInsertNullBlob()

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() : void {
  $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']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.