You are here

public function FeedsAccountSwitcherTest::testFailingImport in Feeds 7.2

Tests if the user is switched back properly when an import fails.

File

tests/FeedsAccountSwitcherTest.test, line 259
Contains FeedsAccountSwitcherTest.

Class

FeedsAccountSwitcherTest
Test case for account switching.

Code

public function testFailingImport() {

  // Set flag that causes feeds_tests_after_parse() to disrupt the import process.
  variable_set('feeds_tests_trigger_import_disruption', TRUE);

  // Assert that the admin user is logged in.
  $this
    ->drupalGet('user');
  $this
    ->clickLink('Edit');
  $this
    ->assertUrl('user/' . $this->admin_user->uid . '/edit');

  // Create a feed node and change author of node.
  $nid = $this
    ->createFeedNode('syndication', NULL, 'Node 1');
  $account = $this
    ->drupalCreateUser(array(
    'access content',
    'create article content',
  ));
  $this
    ->changeNodeAuthor($nid, $account);

  // And perform import.
  $this
    ->drupalPost('node/' . $nid . '/import', NULL, 'Import');
  $this
    ->assertText('An error has occurred.');

  // Assert that the admin user is still logged in.
  $this
    ->drupalGet('user');
  $this
    ->clickLink('Edit');
  $this
    ->assertUrl('user/' . $this->admin_user->uid . '/edit');
}