summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpcambra2013-06-04 19:18:18 (GMT)
committer Juampy2013-06-04 19:18:18 (GMT)
commit85aa960a53cef9220c0efa8c5f43b70818ed2765 (patch)
tree0190b075836f37d3c9875545e2912637e8771caf
parentbdd2f9e81c59da8b40d810306783e009ad10eaa5 (diff)
Issue #2011938 by pcambra: [Drupal 8] Port tests to D8.
-rw-r--r--lib/Drupal/twitter/Tests/TwitterCore.php (renamed from tests/core.test)37
-rw-r--r--lib/Drupal/twitter/Tests/TwitterInputFilters.php (renamed from tests/input_filters.test)48
-rw-r--r--tests/twitter_mock.info6
-rw-r--r--tests/twitter_mock.info.yml9
4 files changed, 55 insertions, 45 deletions
diff --git a/tests/core.test b/lib/Drupal/twitter/Tests/TwitterCore.php
index a70e831..c36ab98 100644
--- a/tests/core.test
+++ b/lib/Drupal/twitter/Tests/TwitterCore.php
@@ -2,31 +2,36 @@
/**
* @file
- * Functional tests for the twitter Module.
+ * Definition of Drupal\twitter\Tests\TwitterCore.
*/
-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.
+namespace Drupal\twitter\Tests;
+
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Tests the Twitter module functionality.
+ */
+class TwitterCore extends WebTestBase {
+
+ /**
+ * Modules to enable.
+ *
+ * @var array
*/
+ public static $modules = array('twitter', 'views', 'twitter_mock');
+
+ protected $user;
+
public static function getInfo() {
return array(
- 'name' => t('Main'),
- 'description' => t('Tests main module features such as adding accounts or loading tweets.'),
- 'group' => t('Twitter'),
+ 'name' => 'Main tests',
+ 'description' => 'Tests main module features such as adding accounts or loading tweets.',
+ 'group' => 'Twitter',
);
}
/**
- * Prepares the testing environment
- */
- function setUp() {
- parent::setUp('twitter', 'views', 'twitter_mock');
- }
-
- /**
* Tests account addition without Oauth module activated
*/
public function testAccountAdditionNoOauth() {
diff --git a/tests/input_filters.test b/lib/Drupal/twitter/Tests/TwitterInputFilters.php
index 0f319df..90aba73 100644
--- a/tests/input_filters.test
+++ b/lib/Drupal/twitter/Tests/TwitterInputFilters.php
@@ -2,31 +2,33 @@
/**
* @file
- * Functional tests for the input filters of the twitter module.
+ * Definition of Drupal\twitter\Tests\TwitterInputFilters.
*/
-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.
+namespace Drupal\twitter\Tests;
+
+use Drupal\simpletest\WebTestBase;
+
+class TwitterInputFilters extends WebTestBase {
+
+ /**
+ * Modules to enable.
+ *
+ * @var array
*/
+ public static $modules = array('twitter');
+
+ protected $privileged_user;
+
public static function getInfo() {
return array(
- 'name' => t('Input filters'),
- 'description' => t('Tests input filters provided by the Twitter module.'),
- 'group' => t('Twitter'),
+ 'name' => 'Input filters',
+ 'description' => 'Tests input filters provided by the Twitter module.',
+ 'group' => 'Twitter',
);
}
/**
- * Prepares the testing environment
- */
- function setUp() {
- parent::setUp('twitter');
- }
-
- /**
* Tests input filters
*/
public function testInputFilters() {
@@ -52,20 +54,20 @@ class TwitterInputFilterTest extends DrupalWebTestCase {
$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'));
+ 'Twitter username input filter has been activated');
$this->assertFieldChecked('edit-filters-twitter-hashtag-status',
- t('Twitter hashtag input filter has been activated'));
+ '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.');
+ $edit['title'] = 'Test page';
+ $edit['body[und][0][value]'] = '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.'));
+ $this->assertLink($search, 0, 'Twitter search input filter was created successfully.');
+ $this->assertLink($username, 0, 'Twitter username input filter was created successfully.');
}
}
diff --git a/tests/twitter_mock.info b/tests/twitter_mock.info
deleted file mode 100644
index 8f4c706..0000000
--- a/tests/twitter_mock.info
+++ /dev/null
@@ -1,6 +0,0 @@
-name = Twitter Mock
-description = Sets up a mock web server to simulate API calls on tests
-core = 7.x
-hidden = TRUE
-dependencies[] = twitter
-dependencies[] = simpletest
diff --git a/tests/twitter_mock.info.yml b/tests/twitter_mock.info.yml
new file mode 100644
index 0000000..12dec2c
--- /dev/null
+++ b/tests/twitter_mock.info.yml
@@ -0,0 +1,9 @@
+name: 'Twitter Mock'
+type: module
+description: 'Sets up a mock web server to simulate API calls on tests'
+package: Testing
+version: VERSION
+core: 8.x
+hidden: true
+dependencies:
+ - twitter