comparison core/modules/system/src/Tests/Module/ModuleTestBase.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children af1871eacc83
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
57 * The name of the module. 57 * The name of the module.
58 */ 58 */
59 public function assertModuleTablesExist($module) { 59 public function assertModuleTablesExist($module) {
60 $tables = array_keys(drupal_get_module_schema($module)); 60 $tables = array_keys(drupal_get_module_schema($module));
61 $tables_exist = TRUE; 61 $tables_exist = TRUE;
62 $schema = Database::getConnection()->schema();
62 foreach ($tables as $table) { 63 foreach ($tables as $table) {
63 if (!db_table_exists($table)) { 64 if (!$schema->tableExists($table)) {
64 $tables_exist = FALSE; 65 $tables_exist = FALSE;
65 } 66 }
66 } 67 }
67 return $this->assertTrue($tables_exist, format_string('All database tables defined by the @module module exist.', ['@module' => $module])); 68 return $this->assertTrue($tables_exist, format_string('All database tables defined by the @module module exist.', ['@module' => $module]));
68 } 69 }
74 * The name of the module. 75 * The name of the module.
75 */ 76 */
76 public function assertModuleTablesDoNotExist($module) { 77 public function assertModuleTablesDoNotExist($module) {
77 $tables = array_keys(drupal_get_module_schema($module)); 78 $tables = array_keys(drupal_get_module_schema($module));
78 $tables_exist = FALSE; 79 $tables_exist = FALSE;
80 $schema = Database::getConnection()->schema();
79 foreach ($tables as $table) { 81 foreach ($tables as $table) {
80 if (db_table_exists($table)) { 82 if ($schema->tableExists($table)) {
81 $tables_exist = TRUE; 83 $tables_exist = TRUE;
82 } 84 }
83 } 85 }
84 return $this->assertFalse($tables_exist, format_string('None of the database tables defined by the @module module exist.', ['@module' => $module])); 86 return $this->assertFalse($tables_exist, format_string('None of the database tables defined by the @module module exist.', ['@module' => $module]));
85 } 87 }