summaryrefslogtreecommitdiffstats
path: root/core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php')
-rw-r--r--core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php b/core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php
index 66eed0a..22173da 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php
@@ -2,6 +2,8 @@
namespace Drupal\KernelTests\Core\Database;
+use Drupal\Core\Database\Database;
+
/**
* Regression tests cases for the database layer.
*
@@ -57,4 +59,16 @@ class RegressionTest extends DatabaseTestBase {
$this->assertSame(FALSE, db_index_exists('test', 'nosuchindex'), 'Returns false for nonexistent index.');
}
+ /**
+ * Tests the db_set_active() function.
+ *
+ * @group legacy
+ *
+ * @expectedDeprecation db_set_active() is deprecated in Drupal 8.0.x and will be removed before Drupal 9.0.0. Use \Drupal\Core\Database\Database::setActiveConnection() instead. See https://www.drupal.org/node/2944084.
+ */
+ public function testDBIsActive() {
+ $get_active_db = Database::getConnection()->getKey();
+ $this->assert(db_set_active($get_active_db), 'Database connection is active');
+ }
+
}