first import

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-08 11:40:19 +02:00
commit 1bc61b12ad
8435 changed files with 1582817 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
<?php
/**
* @file
* Functional tests for the twitter Module.
*/
class TwitterTest extends DrupalWebTestCase {
/*'
* The getInfo() method provides information about the test.
* In order for the test to be run, the getInfo() method needs
* to be implemented.
*/
public static function getInfo() {
return array(
'name' => t('Main functionality'),
'description' => t('Tests main module functionality.'),
'group' => t('Twitter'),
);
}
/**
* Prepares the testing environment
*/
function setUp() {
parent::setUp('twitter', 'views');
}
/**
* Tests account addition without Oauth module activated
*/
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.'));
}
}

View File

@@ -0,0 +1,71 @@
<?php
/**
* @file
* Functional tests for the input filters of the twitter module.
*/
class TwitterInputFilterTest extends DrupalWebTestCase {
/*'
* The getInfo() method provides information about the test.
* In order for the test to be run, the getInfo() method needs
* to be implemented.
*/
public static function getInfo() {
return array(
'name' => t('Input filters'),
'description' => t('Tests input filters provided by the Twitter module.'),
'group' => t('Twitter'),
);
}
/**
* Prepares the testing environment
*/
function setUp() {
parent::setUp('twitter');
}
/**
* Tests input filters
*/
public function testInputFilters() {
// Create user
$this->privileged_user = $this->drupalCreateUser(array(
'bypass node access',
'administer filters',
));
$this->drupalLogin($this->privileged_user);
// Activate twitter input filters
$edit = array(
'filters[twitter_username][status]' => 1,
'filters[twitter_username][weight]' => 0,
'filters[twitter_hashtag][status]' => 1,
'filters[twitter_hashtag][weight]' => 1,
'filters[filter_url][weight]' => 2,
'filters[filter_html][weight]' => 3,
'filters[filter_autop][weight]' => 4,
'filters[filter_htmlcorrector][weight]' => 5,
);
$this->drupalPost('admin/config/content/formats/filtered_html', $edit, t('Save configuration'));
$this->assertText(t('The text format Filtered HTML has been updated.'));
$this->drupalGet('admin/config/content/formats/filtered_html');
$this->assertFieldChecked('edit-filters-twitter-username-status',
t('Twitter username input filter has been activated'));
$this->assertFieldChecked('edit-filters-twitter-hashtag-status',
t('Twitter hashtag input filter has been activated'));
// Create a page so we can evaluate the filters
$search = '#drupal';
$username = '@drupal';
$edit = array();
$edit['title'] = t('Test page');
$edit['body[und][0][value]'] = t('This is a search over #drupal tag. There is also a link ' .
' to a Twitter account here: @drupal.');
$this->drupalPost('node/add/page', $edit, t('Save'));
$this->assertText(t('Basic page @title has been created.', array('@title' => $edit['title'])));
$this->assertLink($search, 0, t('Twitter search input filter was created successfully.'));
$this->assertLink($username, 0, t('Twitter username input filter was created successfully.'));
}
}