You are here

public function DatabaseTestBase::ensureSampleDataNull in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Database/DatabaseTestBase.php \Drupal\KernelTests\Core\Database\DatabaseTestBase::ensureSampleDataNull()
  2. 9 core/tests/Drupal/KernelTests/Core/Database/DatabaseTestBase.php \Drupal\KernelTests\Core\Database\DatabaseTestBase::ensureSampleDataNull()

Sets up tables for NULL handling.

File

core/tests/Drupal/KernelTests/Core/Database/DatabaseTestBase.php, line 48

Class

DatabaseTestBase
Base class for databases database tests.

Namespace

Drupal\KernelTests\Core\Database

Code

public function ensureSampleDataNull() {
  $this->connection
    ->insert('test_null')
    ->fields([
    'name',
    'age',
  ])
    ->values([
    'name' => 'Kermit',
    'age' => 25,
  ])
    ->values([
    'name' => 'Fozzie',
    'age' => NULL,
  ])
    ->values([
    'name' => 'Gonzo',
    'age' => 27,
  ])
    ->execute();
}