summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2017-06-16 11:10:29 (GMT)
committerNathaniel Catchpole2017-06-16 11:10:29 (GMT)
commitf62b4c76f64d3db41a99e77b6e883c2b55588846 (patch)
tree86e815fe3fe0de6d7f2f90b3594bdd749c07f458
parent9dfbd47a25f39aa0386f5726236341600fca3e82 (diff)
Issue #2757023 by claudiu.cristea, naveenvalecha, GoZ, jibran, Jo Fitzgerald, dawehner, klausi: Convert all aggregator web tests to BrowserTestBase
-rw-r--r--core/modules/aggregator/tests/src/Functional/AddFeedTest.php (renamed from core/modules/aggregator/src/Tests/AddFeedTest.php)2
-rw-r--r--core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php (renamed from core/modules/aggregator/src/Tests/AggregatorAdminTest.php)14
-rw-r--r--core/modules/aggregator/tests/src/Functional/AggregatorCronTest.php (renamed from core/modules/aggregator/src/Tests/AggregatorCronTest.php)7
-rw-r--r--core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php (renamed from core/modules/aggregator/src/Tests/AggregatorRenderingTest.php)14
-rw-r--r--core/modules/aggregator/tests/src/Functional/FeedAdminDisplayTest.php (renamed from core/modules/aggregator/src/Tests/FeedAdminDisplayTest.php)2
-rw-r--r--core/modules/aggregator/tests/src/Functional/FeedLanguageTest.php (renamed from core/modules/aggregator/src/Tests/FeedLanguageTest.php)5
-rw-r--r--core/modules/aggregator/tests/src/Functional/UpdateFeedItemTest.php (renamed from core/modules/aggregator/src/Tests/UpdateFeedItemTest.php)2
-rw-r--r--core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php (renamed from core/modules/aggregator/src/Tests/UpdateFeedTest.php)2
8 files changed, 32 insertions, 16 deletions
diff --git a/core/modules/aggregator/src/Tests/AddFeedTest.php b/core/modules/aggregator/tests/src/Functional/AddFeedTest.php
index 4dfeb95..e4f63ea 100644
--- a/core/modules/aggregator/src/Tests/AddFeedTest.php
+++ b/core/modules/aggregator/tests/src/Functional/AddFeedTest.php
@@ -1,6 +1,6 @@
<?php
-namespace Drupal\aggregator\Tests;
+namespace Drupal\Tests\aggregator\Functional;
/**
* Add feed test.
diff --git a/core/modules/aggregator/src/Tests/AggregatorAdminTest.php b/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php
index 01898b6..4b278d6 100644
--- a/core/modules/aggregator/src/Tests/AggregatorAdminTest.php
+++ b/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php
@@ -1,6 +1,6 @@
<?php
-namespace Drupal\aggregator\Tests;
+namespace Drupal\Tests\aggregator\Functional;
/**
* Tests aggregator admin pages.
@@ -67,18 +67,22 @@ class AggregatorAdminTest extends AggregatorTestBase {
// Check if the amount of feeds in the overview matches the amount created.
$this->assertEqual(1, count($result), 'Created feed is found in the overview');
// Check if the fields in the table match with what's expected.
- $this->assertEqual($feed->label(), (string) $result[0]->td[0]->a);
+ $link = $this->xpath('//table/tbody/tr//td[1]/a');
+ $this->assertEquals($feed->label(), $link[0]->getText());
$count = $this->container->get('entity.manager')->getStorage('aggregator_item')->getItemCount($feed);
- $this->assertEqual(\Drupal::translation()->formatPlural($count, '1 item', '@count items'), (string) $result[0]->td[1]);
+ $td = $this->xpath('//table/tbody/tr//td[2]');
+ $this->assertEquals(\Drupal::translation()->formatPlural($count, '1 item', '@count items'), $td[0]->getText());
// Update the items of the first feed.
$feed->refreshItems();
$this->drupalGet('admin/config/services/aggregator');
$result = $this->xpath('//table/tbody/tr');
// Check if the fields in the table match with what's expected.
- $this->assertEqual($feed->label(), (string) $result[0]->td[0]->a);
+ $link = $this->xpath('//table/tbody/tr//td[1]/a');
+ $this->assertEquals($feed->label(), $link[0]->getText());
$count = $this->container->get('entity.manager')->getStorage('aggregator_item')->getItemCount($feed);
- $this->assertEqual(\Drupal::translation()->formatPlural($count, '1 item', '@count items'), (string) $result[0]->td[1]);
+ $td = $this->xpath('//table/tbody/tr//td[2]');
+ $this->assertEquals(\Drupal::translation()->formatPlural($count, '1 item', '@count items'), $td[0]->getText());
}
}
diff --git a/core/modules/aggregator/src/Tests/AggregatorCronTest.php b/core/modules/aggregator/tests/src/Functional/AggregatorCronTest.php
index 9ebb2d2..bb7c90a 100644
--- a/core/modules/aggregator/src/Tests/AggregatorCronTest.php
+++ b/core/modules/aggregator/tests/src/Functional/AggregatorCronTest.php
@@ -1,6 +1,8 @@
<?php
-namespace Drupal\aggregator\Tests;
+namespace Drupal\Tests\aggregator\Functional;
+
+use Drupal\Tests\Traits\Core\CronRunTrait;
/**
* Update feeds on cron.
@@ -8,6 +10,9 @@ namespace Drupal\aggregator\Tests;
* @group aggregator
*/
class AggregatorCronTest extends AggregatorTestBase {
+
+ use CronRunTrait;
+
/**
* Adds feeds and updates them via cron process.
*/
diff --git a/core/modules/aggregator/src/Tests/AggregatorRenderingTest.php b/core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php
index de7e401..37e6470 100644
--- a/core/modules/aggregator/src/Tests/AggregatorRenderingTest.php
+++ b/core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php
@@ -1,6 +1,6 @@
<?php
-namespace Drupal\aggregator\Tests;
+namespace Drupal\Tests\aggregator\Functional;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\views\Entity\View;
@@ -132,10 +132,14 @@ class AggregatorRenderingTest extends AggregatorTestBase {
// Check the opml aggregator page.
$this->drupalGet('aggregator/opml');
- $outline = $this->xpath('//outline[1]');
- $this->assertEqual($outline[0]['type'], 'rss', 'The correct type attribute is used for rss OPML.');
- $this->assertEqual($outline[0]['text'], $feed->label(), 'The correct text attribute is used for rss OPML.');
- $this->assertEqual($outline[0]['xmlurl'], $feed->getUrl(), 'The correct xmlUrl attribute is used for rss OPML.');
+ $content = $this->getSession()->getPage()->getContent();
+ // We can't use Mink xpath queries here because it only supports HTML pages,
+ // but we are dealing with XML here.
+ $xml = simplexml_load_string($content);
+ $attributes = $xml->xpath('//outline[1]')[0]->attributes();
+ $this->assertEquals('rss', $attributes->type);
+ $this->assertEquals($feed->label(), $attributes->text);
+ $this->assertEquals($feed->getUrl(), $attributes->xmlUrl);
// Check for the presence of a pager.
$this->drupalGet('aggregator/sources/' . $feed->id());
diff --git a/core/modules/aggregator/src/Tests/FeedAdminDisplayTest.php b/core/modules/aggregator/tests/src/Functional/FeedAdminDisplayTest.php
index 46366b4..e057be6 100644
--- a/core/modules/aggregator/src/Tests/FeedAdminDisplayTest.php
+++ b/core/modules/aggregator/tests/src/Functional/FeedAdminDisplayTest.php
@@ -1,6 +1,6 @@
<?php
-namespace Drupal\aggregator\Tests;
+namespace Drupal\Tests\aggregator\Functional;
/**
* Tests the display of a feed on the Aggregator list page.
diff --git a/core/modules/aggregator/src/Tests/FeedLanguageTest.php b/core/modules/aggregator/tests/src/Functional/FeedLanguageTest.php
index 98d04fa..7e3d672 100644
--- a/core/modules/aggregator/src/Tests/FeedLanguageTest.php
+++ b/core/modules/aggregator/tests/src/Functional/FeedLanguageTest.php
@@ -1,8 +1,9 @@
<?php
-namespace Drupal\aggregator\Tests;
+namespace Drupal\Tests\aggregator\Functional;
use Drupal\language\Entity\ConfigurableLanguage;
+use Drupal\Tests\Traits\Core\CronRunTrait;
/**
* Tests aggregator feeds in multiple languages.
@@ -11,6 +12,8 @@ use Drupal\language\Entity\ConfigurableLanguage;
*/
class FeedLanguageTest extends AggregatorTestBase {
+ use CronRunTrait;
+
/**
* Modules to install.
*
diff --git a/core/modules/aggregator/src/Tests/UpdateFeedItemTest.php b/core/modules/aggregator/tests/src/Functional/UpdateFeedItemTest.php
index 67e96f1..b850ca9 100644
--- a/core/modules/aggregator/src/Tests/UpdateFeedItemTest.php
+++ b/core/modules/aggregator/tests/src/Functional/UpdateFeedItemTest.php
@@ -1,6 +1,6 @@
<?php
-namespace Drupal\aggregator\Tests;
+namespace Drupal\Tests\aggregator\Functional;
use Drupal\aggregator\Entity\Feed;
/**
diff --git a/core/modules/aggregator/src/Tests/UpdateFeedTest.php b/core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php
index d230874..a81e0ae 100644
--- a/core/modules/aggregator/src/Tests/UpdateFeedTest.php
+++ b/core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php
@@ -1,6 +1,6 @@
<?php
-namespace Drupal\aggregator\Tests;
+namespace Drupal\Tests\aggregator\Functional;
/**
* Update feed test.