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
08616351
Commit
08616351
authored
16 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
#377564
by boombatower: Make run-tests.sh respect the 'simpletest_clear_results' variable.
parent
802f7aa0
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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/simpletest/simpletest.module
+28
-12
28 additions, 12 deletions
modules/simpletest/simpletest.module
scripts/run-tests.sh
+1
-4
1 addition, 4 deletions
scripts/run-tests.sh
with
29 additions
and
16 deletions
modules/simpletest/simpletest.module
+
28
−
12
View file @
08616351
...
...
@@ -123,10 +123,7 @@ function simpletest_test_form() {
}
// Clear test results.
if
(
variable_get
(
'simpletest_clear_results'
,
TRUE
))
{
db_query
(
'DELETE FROM {simpletest} WHERE test_id = %d'
,
$_SESSION
[
'test_id'
]);
db_query
(
'DELETE FROM {simpletest_test_id} WHERE test_id = %d'
,
$_SESSION
[
'test_id'
]);
}
simpletest_clean_results_table
(
$_SESSION
[
'test_id'
]);
unset
(
$_SESSION
[
'test_id'
]);
$all_ok
=
TRUE
;
...
...
@@ -515,7 +512,8 @@ function simpletest_categorize_tests($tests) {
function
simpletest_clean_environment
()
{
simpletest_clean_database
();
simpletest_clean_temporary_directories
();
simpletest_clean_results_table
();
$count
=
simpletest_clean_results_table
();
drupal_set_message
(
t
(
'Removed @count test results.'
,
array
(
'@count'
=>
$count
)));
}
/**
...
...
@@ -564,16 +562,34 @@ function simpletest_clean_temporary_directories() {
}
/**
* Clear the test results tables.
* Clear the test result tables.
*
* @param $test_id
* Test ID to remove results for, or NULL to remove all results.
* @return
* The number of results removed or FALSE.
*/
function
simpletest_clean_results_table
()
{
function
simpletest_clean_results_table
(
$test_id
=
NULL
)
{
if
(
variable_get
(
'simpletest_clear_results'
,
TRUE
))
{
$count
=
db_result
(
db_query
(
'SELECT COUNT(test_id) FROM {simpletest_test_id}'
));
if
(
$test_id
)
{
$count
=
db_result
(
db_query
(
'SELECT COUNT(test_id) FROM {simpletest_test_id} WHERE test_id = :test_id'
,
array
(
':test_id'
=>
$test_id
)));
db_delete
(
"simpletest"
)
->
condition
(
'test_id'
,
$test_id
)
->
execute
();
db_delete
(
"simpletest_test_id"
)
->
condition
(
'test_id'
,
$test_id
)
->
execute
();
}
else
{
$count
=
db_result
(
db_query
(
'SELECT COUNT(test_id) FROM {simpletest_test_id}'
));
// Clear test results.
db_query
(
'DELETE FROM {simpletest}'
);
db_query
(
'DELETE FROM {simpletest_test_id}'
);
// Clear test results.
db_delete
(
"simpletest"
)
->
execute
();
db_delete
(
"simpletest_test_id"
)
->
execute
();
}
drupal_set_message
(
t
(
'Removed @count test results.'
,
array
(
'@count'
=>
$count
)))
;
return
$count
;
}
return
FALSE
;
}
This diff is collapsed.
Click to expand it.
scripts/run-tests.sh
+
1
−
4
View file @
08616351
...
...
@@ -81,10 +81,7 @@
simpletest_script_reporter_display_results
()
;
// Cleanup our
test
results.
db_delete
(
"simpletest"
)
->condition
(
'test_id'
,
$test_id
)
->execute
()
;
simpletest_clean_results_table
(
$test_id
)
;
/
**
*
Print
help
text.
...
...
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