protected function SchemaIntrospectionTestTrait::assertIndexOnColumns in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Database/SchemaIntrospectionTestTrait.php \Drupal\Tests\Core\Database\SchemaIntrospectionTestTrait::assertIndexOnColumns()
- 9 core/tests/Drupal/Tests/Core/Database/SchemaIntrospectionTestTrait.php \Drupal\Tests\Core\Database\SchemaIntrospectionTestTrait::assertIndexOnColumns()
Checks that an index covering exactly the given column names exists.
Parameters
string $table_name: A non-prefixed table name.
array $column_names: An array of column names
string $index_type: (optional) The type of the index. Can be one of 'index', 'unique' or 'primary'. Defaults to 'index'.
File
- core/
tests/ Drupal/ Tests/ Core/ Database/ SchemaIntrospectionTestTrait.php, line 21
Class
- SchemaIntrospectionTestTrait
- Provides methods for testing database schema characteristics.
Namespace
Drupal\Tests\Core\DatabaseCode
protected function assertIndexOnColumns($table_name, array $column_names, $index_type = 'index') {
foreach ($this
->getIndexColumnNames($table_name, $index_type) as $index_columns) {
if ($column_names == $index_columns) {
$this
->assertTrue(TRUE);
return;
}
}
$this
->assertTrue(FALSE);
}