diff core/modules/simpletest/src/Tests/KernelTestBaseTest.php @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents c75dbcec494b
children 12f9dff5fda9
line wrap: on
line diff
--- a/core/modules/simpletest/src/Tests/KernelTestBaseTest.php	Thu Feb 28 11:14:44 2019 +0000
+++ b/core/modules/simpletest/src/Tests/KernelTestBaseTest.php	Thu Feb 28 13:11:55 2019 +0000
@@ -62,7 +62,7 @@
     $this->assertIdentical(\Drupal::moduleHandler()->getImplementations('entity_type_alter'), ['entity_test']);
 
     // Verify that no modules have been installed.
-    $this->assertFalse(db_table_exists($table), "'$table' database table not found.");
+    $this->assertFalse(Database::getConnection()->schema()->tableExists($table), "'$table' database table not found.");
 
     // Verify that the settings.testing.php got taken into account.
     $this->assertTrue(function_exists('simpletest_test_stub_settings_function'));
@@ -114,7 +114,7 @@
     $list = \Drupal::moduleHandler()->getImplementations('hook_info');
     $this->assertFalse(in_array($module, $list), "{$module}_hook_info() in \Drupal::moduleHandler()->getImplementations() not found.");
 
-    $this->assertFalse(db_table_exists($table), "'$table' database table not found.");
+    $this->assertFalse(Database::getConnection()->schema()->tableExists($table), "'$table' database table not found.");
 
     // Install the module.
     \Drupal::service('module_installer')->install([$module]);
@@ -126,7 +126,7 @@
     $list = \Drupal::moduleHandler()->getImplementations('hook_info');
     $this->assertTrue(in_array($module, $list), "{$module}_hook_info() in \Drupal::moduleHandler()->getImplementations() found.");
 
-    $this->assertTrue(db_table_exists($table), "'$table' database table found.");
+    $this->assertTrue(Database::getConnection()->schema()->tableExists($table), "'$table' database table found.");
     $schema = drupal_get_module_schema($module, $table);
     $this->assertTrue($schema, "'$table' table schema found.");
   }
@@ -156,7 +156,7 @@
     $table = 'entity_test_example';
     // Verify that we can install a table from the module schema.
     $this->installSchema($module, $table);
-    $this->assertTrue(db_table_exists($table), "'$table' database table found.");
+    $this->assertTrue(Database::getConnection()->schema()->tableExists($table), "'$table' database table found.");
 
     // Verify that the schema is known to Schema API.
     $schema = drupal_get_module_schema($module, $table);
@@ -171,7 +171,7 @@
     catch (\Exception $e) {
       $this->pass('Exception for non-retrievable schema found.');
     }
-    $this->assertFalse(db_table_exists($table), "'$table' database table not found.");
+    $this->assertFalse(Database::getConnection()->schema()->tableExists($table), "'$table' database table not found.");
     $schema = drupal_get_module_schema($module, $table);
     $this->assertFalse($schema, "'$table' table schema not found.");
 
@@ -185,14 +185,14 @@
     catch (\Exception $e) {
       $this->pass('Exception for non-retrievable schema found.');
     }
-    $this->assertFalse(db_table_exists($table), "'$table' database table not found.");
+    $this->assertFalse(Database::getConnection()->schema()->tableExists($table), "'$table' database table not found.");
     $schema = drupal_get_module_schema($module, $table);
     $this->assertTrue($schema, "'$table' table schema found.");
 
     // Verify that the same table can be installed after enabling the module.
     $this->enableModules([$module]);
     $this->installSchema($module, $table);
-    $this->assertTrue(db_table_exists($table), "'$table' database table found.");
+    $this->assertTrue(Database::getConnection()->schema()->tableExists($table), "'$table' database table found.");
     $schema = drupal_get_module_schema($module, $table);
     $this->assertTrue($schema, "'$table' table schema found.");
   }
@@ -206,7 +206,7 @@
     $this->enableModules(['user']);
     // Verity that the entity schema is created properly.
     $this->installEntitySchema($entity);
-    $this->assertTrue(db_table_exists($entity), "'$entity' database table found.");
+    $this->assertTrue(Database::getConnection()->schema()->tableExists($entity), "'$entity' database table found.");
   }
 
   /**
@@ -278,7 +278,7 @@
     $field_storage = FieldStorageConfig::create([
       'field_name' => 'test_field',
       'entity_type' => 'entity_test',
-      'type' => 'test_field'
+      'type' => 'test_field',
     ]);
     $field_storage->save();
     FieldConfig::create([
@@ -354,7 +354,7 @@
       $info = Database::getConnectionInfo();
       $connection->query('ATTACH DATABASE :database AS :prefix', [
         ':database' => $info['default']['database'] . '-' . $this->databasePrefix,
-        ':prefix' => $this->databasePrefix
+        ':prefix' => $this->databasePrefix,
       ]);
 
       $result = $connection->query("SELECT name FROM " . $this->databasePrefix . ".sqlite_master WHERE type = :type AND name LIKE :table_name AND name NOT LIKE :pattern", [