Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
f19d83c4
Commit
f19d83c4
authored
Sep 27, 2008
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
#302300
follow-up by Crell: Fixes to database connection tests.
parent
2cb811ac
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
includes/database/database.inc
+1
-1
1 addition, 1 deletion
includes/database/database.inc
modules/simpletest/tests/database_test.test
+6
-4
6 additions, 4 deletions
modules/simpletest/tests/database_test.test
with
7 additions
and
5 deletions
includes/database/database.inc
+
1
−
1
View file @
f19d83c4
...
@@ -839,7 +839,7 @@ final public static function getConnectionInfo($key = 'default') {
...
@@ -839,7 +839,7 @@ final public static function getConnectionInfo($key = 'default') {
final
protected
static
function
openConnection
(
$key
,
$target
)
{
final
protected
static
function
openConnection
(
$key
,
$target
)
{
global
$db_prefix
;
global
$db_prefix
;
if
(
empty
(
self
::
$
connection
Info
))
{
if
(
empty
(
self
::
$
database
Info
))
{
self
::
parseConnectionInfo
();
self
::
parseConnectionInfo
();
}
}
try
{
try
{
...
...
This diff is collapsed.
Click to expand it.
modules/simpletest/tests/database_test.test
+
6
−
4
View file @
f19d83c4
...
@@ -127,13 +127,15 @@ class DatabaseConnectionTestCase extends DatabaseTestCase {
...
@@ -127,13 +127,15 @@ class DatabaseConnectionTestCase extends DatabaseTestCase {
// Clone the master credentials to a slave connection.
// Clone the master credentials to a slave connection.
// Note this will result in two independent connection objects that happen
// Note this will result in two independent connection objects that happen
// to point to the same place.
// to point to the same place.
$connection_info
=
Database
::
getConnectionInfo
();
$connection_info
=
Database
::
getConnectionInfo
(
'default'
);
Database
::
addConnectionInfo
(
'default'
,
'slave'
,
$connection_info
[
'default'
]
[
'default'
]
);
Database
::
addConnectionInfo
(
'default'
,
'slave'
,
$connection_info
[
'default'
]);
$db1
=
Database
::
getConnection
(
'default'
,
'default'
);
$db1
=
Database
::
getConnection
(
'default'
,
'default'
);
$db2
=
Database
::
getConnection
(
'default'
,
'slave'
);
$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 {
...
@@ -152,7 +154,7 @@ class DatabaseConnectionTestCase extends DatabaseTestCase {
$db1
=
Database
::
getConnection
(
'default'
,
'default'
);
$db1
=
Database
::
getConnection
(
'default'
,
'default'
);
$db2
=
Database
::
getConnection
(
'default'
,
'slave'
);
$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.'
));
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment