function ModuleTestBase::assertModuleTablesExist

Assert that all tables defined in a module's hook_schema() exist.

Parameters

$module: The name of the module.

2 calls to ModuleTestBase::assertModuleTablesExist()
EnableDisableTest::assertSuccessfulDisableAndUninstall in drupal/core/modules/system/lib/Drupal/system/Tests/Module/EnableDisableTest.php
Disables and uninstalls a module and asserts that it was done correctly.
EnableDisableTest::testEnableDisable in drupal/core/modules/system/lib/Drupal/system/Tests/Module/EnableDisableTest.php
Tests that all core modules can be enabled, disabled and uninstalled.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Module/ModuleTestBase.php, line 59
Definition of Drupal\system\Tests\Module\ModuleTestBase.

Class

ModuleTestBase
Helper class for module test cases.

Namespace

Drupal\system\Tests\Module

Code

function assertModuleTablesExist($module) {
  $this
    ->rebuildContainer();
  $tables = array_keys(drupal_get_schema_unprocessed($module));
  $tables_exist = TRUE;
  foreach ($tables as $table) {
    if (!db_table_exists($table)) {
      $tables_exist = FALSE;
    }
  }
  return $this
    ->assertTrue($tables_exist, format_string('All database tables defined by the @module module exist.', array(
    '@module' => $module,
  )));
}