You are here

public function RegressionTest::testDBIndexExists 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::testDBIndexExists()

Tests the Schema::indexExists() method.

File

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

Class

RegressionTest
Regression tests cases for the database layer.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testDBIndexExists() {
  $this
    ->assertTrue($this->connection
    ->schema()
    ->indexExists('test', 'ages'), 'Returns true for existent index.');
  $this
    ->assertFalse($this->connection
    ->schema()
    ->indexExists('test', 'no_such_index'), 'Returns false for nonexistent index.');
}