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
1d09ec33
Commit
1d09ec33
authored
Oct 13, 2009
by
webchick
Browse files
#602958
by chx: Added API function to SimpleTest to run cron, avoiding fatal errors.
parent
89d04ea7
Changes
5
Hide whitespace changes
Inline
Side-by-side
includes/common.inc
View file @
1d09ec33
...
...
@@ -4098,9 +4098,12 @@ function drupal_page_set_cache() {
}
/**
* Executes a cron run when called
* Executes a cron run when called.
*
* Do not call this function from test, use $this->cronRun() instead.
*
* @return
* Returns TRUE if ran successfully
*
Returns TRUE if ran successfully
*/
function
drupal_cron_run
()
{
// Allow execution to continue even if the request gets canceled.
...
...
modules/search/search.test
View file @
1d09ec33
...
...
@@ -499,7 +499,7 @@ class SearchCommentTestCase extends DrupalWebTestCase {
// Invoke search index update.
$this
->
drupalLogout
();
$this
->
drupalGet
(
$GLOBALS
[
'base_url'
]
.
'/cron.php'
,
array
(
'external'
=>
TRUE
,
'query'
=>
array
(
'cron_key'
=>
variable_get
(
'cron_key'
,
'drupal'
)))
);
$this
->
cronRun
(
);
// Search for $title.
$edit
=
array
(
...
...
@@ -521,7 +521,7 @@ class SearchCommentTestCase extends DrupalWebTestCase {
// Invoke search index update.
$this
->
drupalLogout
();
$this
->
drupalGet
(
$GLOBALS
[
'base_url'
]
.
'/cron.php'
,
array
(
'external'
=>
TRUE
,
'query'
=>
array
(
'cron_key'
=>
variable_get
(
'cron_key'
,
'drupal'
)))
);
$this
->
cronRun
(
);
// Search for $title.
$this
->
drupalPost
(
''
,
$edit
,
t
(
'Search'
));
...
...
modules/simpletest/drupal_web_test_case.php
View file @
1d09ec33
...
...
@@ -1499,6 +1499,13 @@ protected function drupalPost($path, $edit, $submit, array $options = array(), a
}
}
/**
* Runs cron in the Drupal installed by Simpletest.
*/
protected
function
cronRun
()
{
$this
->
drupalGet
(
$GLOBALS
[
'base_url'
]
.
'/cron.php'
,
array
(
'external'
=>
TRUE
,
'query'
=>
array
(
'cron_key'
=>
variable_get
(
'cron_key'
,
'drupal'
))));
}
/**
* Check for meta refresh tag and if found call drupalGet() recursively. This
* function looks for the http-equiv attribute to be set to "Refresh"
...
...
modules/system/system.test
View file @
1d09ec33
...
...
@@ -386,9 +386,6 @@ class CronRunTestCase extends DrupalWebTestCase {
$key
=
variable_get
(
'cron_key'
,
'drupal'
);
$this
->
drupalGet
(
$base_url
.
'/cron.php'
,
array
(
'external'
=>
TRUE
,
'query'
=>
array
(
'cron_key'
=>
$key
)));
$this
->
assertResponse
(
200
);
// Execute cron directly.
$this
->
assertTrue
(
drupal_cron_run
(),
t
(
'Cron ran successfully.'
));
}
/**
...
...
@@ -475,7 +472,7 @@ class CronRunTestCase extends DrupalWebTestCase {
$this
->
assertTrue
(
file_exists
(
$perm_new
->
uri
),
t
(
'New permanent file was created correctly.'
));
// Run cron and then ensure that only the old, temp file was deleted.
$this
->
assertTrue
(
drupal_
cron
_r
un
()
,
t
(
'Cron ran successfully.'
))
;
$this
->
cron
R
un
();
$this
->
assertFalse
(
file_exists
(
$temp_old
->
uri
),
t
(
'Old temp file was correctly removed.'
));
$this
->
assertTrue
(
file_exists
(
$temp_new
->
uri
),
t
(
'New temp file was correctly ignored.'
));
$this
->
assertTrue
(
file_exists
(
$perm_old
->
uri
),
t
(
'Old permanent file was correctly ignored.'
));
...
...
modules/trigger/trigger.test
View file @
1d09ec33
...
...
@@ -165,7 +165,7 @@ class TriggerCronTestCase extends DrupalWebTestCase {
$this
->
drupalPost
(
'admin/structure/trigger/system'
,
$edit
,
t
(
'Assign'
));
// Force a cron run.
drupal_
cron
_r
un
();
$this
->
cron
R
un
();
// Make sure the non-configurable action has fired.
$action_run
=
variable_get
(
'trigger_test_system_cron_action'
,
FALSE
);
...
...
Write
Preview
Markdown
is supported
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