function SchemaInspector::getTableNames

Same name and namespace in other branches
  1. main core/tests/Drupal/TestTools/Extension/SchemaInspector.php \Drupal\TestTools\Extension\SchemaInspector::getTableNames()

Returns the module's schema table names.

This function can be used to retrieve a schema specification provided by hook_schema(), so it allows you to derive your tables from existing specifications.

Parameters

\Drupal\Core\Extension\ModuleHandlerInterface $handler: The module handler to use for calling schema hook.

string $module: The module to which the tables belong.

Return value

list<string> A list of table names.

See also

\hook_schema()

2 calls to SchemaInspector::getTableNames()
ModuleTestBase::assertModuleTablesDoNotExist in core/modules/system/tests/src/Functional/Module/ModuleTestBase.php
Assert that none of the tables defined in a module's hook_schema() exist.
ModuleTestBase::assertModuleTablesExist in core/modules/system/tests/src/Functional/Module/ModuleTestBase.php
Assert that all tables defined in a module's hook_schema() exist.

File

core/tests/Drupal/TestTools/Extension/SchemaInspector.php, line 62

Class

SchemaInspector
Provides methods to access modules' schema.

Namespace

Drupal\TestTools\Extension

Code

public static function getTableNames(ModuleHandlerInterface $handler, string $module) : array {
  $schema = self::getTablesSpecification($handler, $module);
  return $schema instanceof Schema ? $schema->tableNames() : array_keys($schema);
}

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