Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
f19d83c4
Commit
f19d83c4
authored
Sep 27, 2008
by
webchick
Browse files
#302300
follow-up by Crell: Fixes to database connection tests.
parent
2cb811ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
includes/database/database.inc
View file @
f19d83c4
...
...
@@ -839,7 +839,7 @@ final public static function getConnectionInfo($key = 'default') {
final
protected
static
function
openConnection
(
$key
,
$target
)
{
global
$db_prefix
;
if
(
empty
(
self
::
$
connection
Info
))
{
if
(
empty
(
self
::
$
database
Info
))
{
self
::
parseConnectionInfo
();
}
try
{
...
...
modules/simpletest/tests/database_test.test
View file @
f19d83c4
...
...
@@ -127,13 +127,15 @@ class DatabaseConnectionTestCase extends DatabaseTestCase {
// Clone the master credentials to a slave connection.
// Note this will result in two independent connection objects that happen
// to point to the same place.
$connection_info
=
Database
::
getConnectionInfo
();
Database
::
addConnectionInfo
(
'default'
,
'slave'
,
$connection_info
[
'default'
]
[
'default'
]
);
$connection_info
=
Database
::
getConnectionInfo
(
'default'
);
Database
::
addConnectionInfo
(
'default'
,
'slave'
,
$connection_info
[
'default'
]);
$db1
=
Database
::
getConnection
(
'default'
,
'default'
);
$db2
=
Database
::
getConnection
(
'default'
,
'slave'
);
$this
->
assertFalse
(
$db1
===
$db2
,
t
(
'Each target refers to a different connection.'
));
$this
->
assertNotNull
(
$db1
,
t
(
'default connection is a real connection object.'
));
$this
->
assertNotNull
(
$db2
,
t
(
'slave connection is a real connection object.'
));
$this
->
assertNotIdentical
(
$db1
,
$db2
,
t
(
'Each target refers to a different connection.'
));
}
/**
...
...
@@ -152,7 +154,7 @@ class DatabaseConnectionTestCase extends DatabaseTestCase {
$db1
=
Database
::
getConnection
(
'default'
,
'default'
);
$db2
=
Database
::
getConnection
(
'default'
,
'slave'
);
$this
->
assert
True
(
$db1
===
$db2
,
t
(
'Both targets refer to the same connection.'
));
$this
->
assert
Identical
(
$db1
,
$db2
,
t
(
'Both targets refer to the same connection.'
));
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment