Loops watchdog messages up to actions_max_stack times.
Creates an infinite loop by causing a watchdog message to be set, which causes the actions to be triggered again, up to action_max_stack times.
protected function triggerActions() {
$this
->drupalGet('<front>', array(
'query' => array(
'trigger_action_on_watchdog' => $this->aid,
),
));
$expected = array();
$expected[] = 'Triggering action loop';
$recursion_limit = config('action.settings')
->get('recursion_limit');
for ($i = 1; $i <= $recursion_limit; $i++) {
$expected[] = "Test log #{$i}";
}
$expected[] = 'Stack overflow: recursion limit for actions_do() has been reached. Stack is limited by %limit calls.';
$result = db_query("SELECT message FROM {watchdog} WHERE type = 'action_loop_test' OR type = 'action' ORDER BY wid");
$loop_started = FALSE;
foreach ($result as $row) {
$expected_message = array_shift($expected);
$this
->assertEqual($row->message, $expected_message, format_string('Expected message %expected, got %message.', array(
'%expected' => $expected_message,
'%message' => $row->message,
)));
}
$this
->assertTrue(empty($expected), 'All expected messages found.');
}