Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
72558ac8
Commit
72558ac8
authored
Feb 26, 2013
by
Angie Byron
Browse files
Issue
#1925658
by gielfeldt, mitron: Fixed Use of slaves breaks site.
parent
4001ef85
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/modules/system/lib/Drupal/system/Tests/System/SystemInitTest.php
0 → 100644
View file @
72558ac8
<?php
/**
* Definition of Drupal\system\Tests\System\SystemInitTest.
*/
namespace
Drupal\system\Tests\System
;
use
Drupal\Core\Database\Database
;
use
\
Drupal\simpletest\UnitTestBase
;
use
\
Symfony\Component\HttpFoundation\Request
;
/**
* Tests system_init().
*/
class
SystemInitTest
extends
UnitTestBase
{
public
static
function
getInfo
()
{
return
array
(
'name'
=>
'System Init'
,
'description'
=>
'Tests the system_init function in system.module.'
,
'group'
=>
'System'
,
);
}
/**
* Tests that system_init properly ignores slaves when requested.
*/
function
testSystemInitIgnoresSlaves
()
{
// 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
(
'default'
);
Database
::
addConnectionInfo
(
'default'
,
'slave'
,
$connection_info
[
'default'
]);
db_ignore_slave
();
system_init
();
$db1
=
Database
::
getConnection
(
'default'
,
'default'
);
$db2
=
Database
::
getConnection
(
'slave'
,
'default'
);
$this
->
assertIdentical
(
$db1
,
$db2
,
'System Init ignores slaves when requested.'
);
}
}
core/modules/system/system.module
View file @
72558ac8
...
...
@@ -5,6 +5,7 @@
* Configuration system that lets administrators modify the workings of the site.
*/
use
Drupal\Core\Database\Database
;
use
Drupal\Core\Utility\ModuleInfo
;
use
Drupal\Core\TypedData\Primitive
;
use
Drupal\system\Plugin\block\block\SystemMenuBlock
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment