function LoopTest::testActionLoop

Sets up a loop with 3 - 12 recursions, and sees if it aborts properly.

File

drupal/core/modules/action/lib/Drupal/action/Tests/LoopTest.php, line 37
Definition of Drupal\action\Tests\LoopTest.

Class

LoopTest
Tests aborting of actions executing in a potential loop.

Namespace

Drupal\action\Tests

Code

function testActionLoop() {
  $user = $this
    ->drupalCreateUser(array(
    'administer actions',
  ));
  $this
    ->drupalLogin($user);
  $info = action_loop_test_action_info();
  $this->aid = action_save('action_loop_test_log', $info['action_loop_test_log']['type'], array(), $info['action_loop_test_log']['label']);

  // Delete any existing watchdog messages to clear the plethora of
  // "Action added" messages from when Drupal was installed.
  db_delete('watchdog')
    ->execute();

  // To prevent this test from failing when xdebug is enabled, the maximum
  // recursion level should be kept low enough to prevent the xdebug
  // infinite recursion protection mechanism from aborting the request.
  // See http://drupal.org/node/587634.
  config('action.settings')
    ->set('recursion_limit', 7)
    ->save();
  $this
    ->triggerActions();
}