function ModuleTestBase::assertModuleTablesDoNotExist
Same name in other branches
- 8.9.x core/modules/system/src/Tests/Module/ModuleTestBase.php \Drupal\system\Tests\Module\ModuleTestBase::assertModuleTablesDoNotExist()
- 8.9.x core/modules/system/tests/src/Functional/Module/ModuleTestBase.php \Drupal\Tests\system\Functional\Module\ModuleTestBase::assertModuleTablesDoNotExist()
- 10 core/modules/system/tests/src/Functional/Module/ModuleTestBase.php \Drupal\Tests\system\Functional\Module\ModuleTestBase::assertModuleTablesDoNotExist()
- 11.x core/modules/system/tests/src/Functional/Module/ModuleTestBase.php \Drupal\Tests\system\Functional\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/ tests/ src/ Functional/ ConfigImportAllTest.php - Tests that a fixed set of modules can be installed and uninstalled.
- InstallUninstallTest::assertModuleNotInstalled in core/
modules/ system/ tests/ src/ Functional/ Module/ InstallUninstallTest.php - Asserts that a module is not yet installed.
- InstallUninstallTest::assertSuccessfulUninstall in core/
modules/ system/ tests/ src/ Functional/ Module/ InstallUninstallTest.php - Uninstalls a module and asserts that it was done correctly.
File
-
core/
modules/ system/ tests/ src/ Functional/ Module/ ModuleTestBase.php, line 64
Class
- ModuleTestBase
- Helper class for module test cases.
Namespace
Drupal\Tests\system\Functional\ModuleCode
public function assertModuleTablesDoNotExist($module) {
$tables = array_keys(SchemaInspector::getTablesSpecification(\Drupal::moduleHandler(), $module));
$tables_exist = FALSE;
$schema = Database::getConnection()->schema();
foreach ($tables as $table) {
if ($schema->tableExists($table)) {
$tables_exist = TRUE;
}
}
$this->assertFalse($tables_exist, new FormattableMarkup('None of the database tables defined by the @module module exist.', [
'@module' => $module,
]));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.