X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fsimpletest%2Fsrc%2FTests%2FKernelTestBaseTest.php;h=fc0d918b8af58ea6bbdf0b8cdbbec89f2e2502ba;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hp=1e9e75da0b91a47ee38527c75aa50d86fca4b092;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/simpletest/src/Tests/KernelTestBaseTest.php b/web/core/modules/simpletest/src/Tests/KernelTestBaseTest.php index 1e9e75da0..fc0d918b8 100644 --- a/web/core/modules/simpletest/src/Tests/KernelTestBaseTest.php +++ b/web/core/modules/simpletest/src/Tests/KernelTestBaseTest.php @@ -62,7 +62,7 @@ EOS; $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 @@ EOS; $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 @@ EOS; $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 @@ EOS; $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 @@ EOS; 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 @@ EOS; 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 @@ EOS; $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 @@ EOS; $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 @@ EOS; $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", [