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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
b3e8f84b
Commit
b3e8f84b
authored
5 years ago
by
catch
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3046393
by claudiu.cristea, dawehner: Convert ConnectionFailureTest into a Kernel test
parent
d938b0a8
Loading
Loading
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
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/dblog/tests/src/Kernel/ConnectionFailureTest.php
+12
-9
12 additions, 9 deletions
.../modules/dblog/tests/src/Kernel/ConnectionFailureTest.php
with
12 additions
and
9 deletions
core/modules/dblog/tests/src/
Functiona
l/ConnectionFailureTest.php
→
core/modules/dblog/tests/src/
Kerne
l/ConnectionFailureTest.php
+
12
−
9
View file @
b3e8f84b
<?php
namespace
Drupal\Tests\dblog\
Functiona
l
;
namespace
Drupal\Tests\dblog\
Kerne
l
;
use
Drupal\Core\Database\Database
;
use
Drupal\
Tests\Browser
TestBase
;
use
Drupal\
KernelTests\Kernel
TestBase
;
/**
* Tests logging of connection failures.
*
* @group dblog
*/
class
ConnectionFailureTest
extends
Browser
TestBase
{
class
ConnectionFailureTest
extends
Kernel
TestBase
{
public
static
$modules
=
[
'dblog'
];
/**
* {@inheritdoc}
*/
protected
static
$modules
=
[
'dblog'
];
/**
* Tests logging of connection failures.
*/
public
function
testConnectionFailureLogging
()
{
$
logger
=
\Drupal
::
service
(
'logger.factory'
);
$
this
->
installSchema
(
'dblog'
,
[
'watchdog'
]
);
// MySQL errors like "1153 - Got a packet bigger than 'max_allowed_packet'
// bytes" or "1100 - Table 'xyz' was not locked with LOCK TABLES" lead to a
...
...
@@ -31,13 +34,13 @@ public function testConnectionFailureLogging() {
Database
::
closeConnection
();
// Create a log entry.
$
logger
->
get
(
'php'
)
->
error
(
'testConnectionFailureLogging'
);
$
this
->
container
->
get
(
'logger.factory'
)
->
get
(
'php'
)
->
error
(
'testConnectionFailureLogging'
);
// Re-establish the default database connection.
Database
::
getConnection
();
$database
=
Database
::
getConnection
();
$wid
=
db_
query
(
"SELECT MAX(wid) FROM
{
watchdog
}
WHERE message = 'testConnectionFailureLogging'"
)
->
fetchField
();
$this
->
assertTrue
(
$wid
,
'Watchdog entry has been stored in database.'
);
$wid
=
$database
->
query
(
"SELECT MAX(wid) FROM
{
watchdog
}
WHERE message = 'testConnectionFailureLogging'"
)
->
fetchField
();
$this
->
assertTrue
(
$wid
);
}
}
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
register
or
sign in
to comment