You are here

function ModuleTestBase::assertModuleTablesDoNotExist in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Module/ModuleTestBase.php \Drupal\system\Tests\Module\ModuleTestBase::assertModuleTablesDoNotExist()

Assert that none of the tables defined in a module's hook_schema() exist.

Parameters

$module: The name of the module.

3 calls to ModuleTestBase::assertModuleTablesDoNotExist()
ConfigImportAllTest::testInstallUninstall in core/modules/config/src/Tests/ConfigImportAllTest.php
Tests that a fixed set of modules can be installed and uninstalled.
InstallUninstallTest::assertModuleNotInstalled in core/modules/system/src/Tests/Module/InstallUninstallTest.php
Asserts that a module is not yet installed.
InstallUninstallTest::assertSuccessfulUninstall in core/modules/system/src/Tests/Module/InstallUninstallTest.php
Uninstalls a module and asserts that it was done correctly.

File

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

Class

ModuleTestBase
Helper class for module test cases.

Namespace

Drupal\system\Tests\Module

Code

function assertModuleTablesDoNotExist($module) {
  $tables = array_keys(drupal_get_module_schema($module));
  $tables_exist = FALSE;
  foreach ($tables as $table) {
    if (db_table_exists($table)) {
      $tables_exist = TRUE;
    }
  }
  return $this
    ->assertFalse($tables_exist, format_string('None of the database tables defined by the @module module exist.', array(
    '@module' => $module,
  )));
}