You are here

function ModuleTestBase::assertModuleTablesExist in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/system/src/Tests/Module/ModuleTestBase.php \Drupal\system\Tests\Module\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()
ConfigImportAllTest::testInstallUninstall in core/modules/config/src/Tests/ConfigImportAllTest.php
Tests that a fixed set of modules can be installed and uninstalled.
InstallUninstallTest::assertModuleSuccessfullyInstalled in core/modules/system/src/Tests/Module/InstallUninstallTest.php
Asserts that a module was successfully installed.

File

core/modules/system/src/Tests/Module/ModuleTestBase.php, line 61
Contains \Drupal\system\Tests\Module\ModuleTestBase.

Class

ModuleTestBase
Helper class for module test cases.

Namespace

Drupal\system\Tests\Module

Code

function assertModuleTablesExist($module) {
  $tables = array_keys(drupal_get_module_schema($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,
  )));
}