summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2016-07-20 08:58:06 (GMT)
committerAlex Pott2016-07-20 08:58:06 (GMT)
commit67b76a049cddc20b871bd14651aaa1a8d31757e9 (patch)
tree8cf19a3bc6367a8520a67ac7bd2da234f24b0620
parent5601e988aee050573a4ff0dc6d5c9be4529e566c (diff)
Revert "Issue #2223073 by stefan.r, superspring, Dave Reid, Jalandhar: Calling DatabaseSchema::getPrefixInfo() on a non-default connection returns the wrong database - write tests"
This reverts commit 2c2caccd45da80ec1aecdfa8905bd7d8765b1c2f.
-rw-r--r--core/tests/Drupal/KernelTests/Core/Database/PrefixInfoTest.php58
1 files changed, 0 insertions, 58 deletions
diff --git a/core/tests/Drupal/KernelTests/Core/Database/PrefixInfoTest.php b/core/tests/Drupal/KernelTests/Core/Database/PrefixInfoTest.php
deleted file mode 100644
index 94c3dd1..0000000
--- a/core/tests/Drupal/KernelTests/Core/Database/PrefixInfoTest.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-namespace Drupal\KernelTests\Core\Database;
-
-use Drupal\Core\Database\Database;
-
-/**
- * Tests that the prefix info for a database schema is correct.
- *
- * @group Database
- */
-class PrefixInfoTest extends DatabaseTestBase {
-
- /**
- * Tests that DatabaseSchema::getPrefixInfo() returns the right database.
- */
- public function testGetPrefixInfo() {
- $connection_info = Database::getConnectionInfo('default');
- // Copy the default connection info to the 'extra' key.
- Database::addConnectionInfo('extra', 'default', $connection_info['default']);
-
- $db1_connection = Database::getConnection('default', 'default');
- $db1_schema = $db1_connection->schema();
- $db2_connection = Database::getConnection('default', 'extra');
-
- // Get the prefix info for the first databse.
- $method = new \ReflectionMethod($db1_schema, 'getPrefixInfo');
- $method->setAccessible(TRUE);
- $db1_info = $method->invoke($db1_schema);
-
- // We change the database after opening the connection, so as to prevent
- // connecting to a non-existent database.
- $reflection = new \ReflectionObject($db2_connection);
- $property = $reflection->getProperty('connectionOptions');
- $property->setAccessible(TRUE);
- $connection_info['default']['database'] = 'foobar';
- $property->setValue($db2_connection, $connection_info['default']);
-
- // For testing purposes, we also change the database info.
- $reflection_class = new \ReflectionClass('Drupal\Core\Database\Database');
- $property = $reflection_class->getProperty('databaseInfo');
- $property->setAccessible(TRUE);
- $info = $property->getValue();
- $info['extra']['default']['database'] = 'foobar';
- $property->setValue(NULL, $info);
-
- $extra_info = Database::getConnectionInfo('extra');
- $this->assertSame($extra_info['default']['database'], 'foobar');
- $db2_schema = $db2_connection->schema();
- $db2_info = $method->invoke($db2_schema);
-
- $this->assertNotSame($db2_info['database'], $db1_info['database'], 'Each target connection has a different database.');
- $this->assertSame($db2_info['database'], 'foobar', 'The new profile has a different database.');
-
- Database::removeConnection('extra');
- }
-
-}