public function TwitterTest::testAccountAdditionNoOauth in Twitter 7.3
Same name and namespace in other branches
- 6.5 tests/core.test \TwitterTest::testAccountAdditionNoOauth()
- 6.4 tests/core.test \TwitterTest::testAccountAdditionNoOauth()
- 7.6 tests/core.test \TwitterTest::testAccountAdditionNoOauth()
- 7.4 tests/core.test \TwitterTest::testAccountAdditionNoOauth()
- 7.5 tests/core.test \TwitterTest::testAccountAdditionNoOauth()
Tests account addition without Oauth module activated
File
- tests/core.test, line 32 
- Functional tests for the twitter Module.
Class
- TwitterTest
- @file Functional tests for the twitter Module.
Code
public function testAccountAdditionNoOauth() {
  // Create user
  $this->user = $this
    ->drupalCreateUser(array(
    'add twitter accounts',
    'import own tweets',
  ));
  $this
    ->drupalLogin($this->user);
  // Add a Twitter account
  $edit = array(
    'screen_name' => 'drupal',
  );
  $this
    ->drupalPost('user/' . $this->user->uid . '/edit/twitter', $edit, t('Add account'));
  $this
    ->assertLink('drupal', 0, t('Twitter account was added successfully'));
  // Load tweets
  twitter_cron();
  $this
    ->drupalGet('user/' . $this->user->uid . '/tweets');
  $elements = $this
    ->xpath('//div[contains(@class, "view-tweets")]/div/table');
  $this
    ->assertTrue(count($elements), 'Tweets were loaded successfully.');
  // Delete the Twitter account
  $edit = array(
    'accounts[0][delete]' => 1,
  );
  $this
    ->drupalPost('user/' . $this->user->uid . '/edit/twitter', $edit, t('Save changes'));
  $this
    ->assertText(t('The Twitter account was deleted.'));
}