function RegressionTest::testDBFieldExists

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php \Drupal\KernelTests\Core\Database\RegressionTest::testDBFieldExists()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php \Drupal\KernelTests\Core\Database\RegressionTest::testDBFieldExists()
  3. 11.x core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php \Drupal\KernelTests\Core\Database\RegressionTest::testDBFieldExists()

Tests the \Drupal\Core\Database\Schema::fieldExists() method.

File

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

Class

RegressionTest
Regression tests cases for the database layer.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testDBFieldExists() : void {
    $schema = $this->connection
        ->schema();
    $this->assertTrue($schema->fieldExists('test', 'name'), 'Returns true for existent column.');
    $this->assertFalse($schema->fieldExists('test', 'no_such_column'), 'Returns false for nonexistent column.');
}

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