You are here

public function RegressionTest::testDBTableExists in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php \Drupal\KernelTests\Core\Database\RegressionTest::testDBTableExists()

Tests the Schema::tableExists() method.

File

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

Class

RegressionTest
Regression tests cases for the database layer.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testDBTableExists() {
  $this
    ->assertTrue($this->connection
    ->schema()
    ->tableExists('test'), 'Returns true for existent table.');
  $this
    ->assertFalse($this->connection
    ->schema()
    ->tableExists('no_such_table'), 'Returns false for nonexistent table.');
}