You are here

function RegressionTest::testDBFieldExists in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Database/RegressionTest.php \Drupal\system\Tests\Database\RegressionTest::testDBFieldExists()

Tests the db_field_exists() function.

File

core/modules/system/src/Tests/Database/RegressionTest.php, line 52
Contains \Drupal\system\Tests\Database\RegressionTest.

Class

RegressionTest
Regression tests cases for the database layer.

Namespace

Drupal\system\Tests\Database

Code

function testDBFieldExists() {
  $this
    ->assertIdentical(TRUE, db_field_exists('test', 'name'), 'Returns true for existent column.');
  $this
    ->assertIdentical(FALSE, db_field_exists('test', 'nosuchcolumn'), 'Returns false for nonexistent column.');
}