Commit f62b4c76 authored by catch's avatar catch

Issue #2757023 by claudiu.cristea, naveenvalecha, GoZ, jibran, Jo Fitzgerald,...

Issue #2757023 by claudiu.cristea, naveenvalecha, GoZ, jibran, Jo Fitzgerald, dawehner, klausi: Convert all aggregator web tests to BrowserTestBase
parent 9dfbd47a
<?php
namespace Drupal\aggregator\Tests;
namespace Drupal\Tests\aggregator\Functional;
/**
* Add feed test.
......
<?php
namespace Drupal\aggregator\Tests;
namespace Drupal\Tests\aggregator\Functional;
/**
* Tests aggregator admin pages.
......@@ -67,18 +67,22 @@ public function testOverviewPage() {
// 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());
}
}
<?php
namespace Drupal\aggregator\Tests;
namespace Drupal\Tests\aggregator\Functional;
use Drupal\Tests\Traits\Core\CronRunTrait;
/**
* Update feeds on cron.
......@@ -8,6 +10,9 @@
* @group aggregator
*/
class AggregatorCronTest extends AggregatorTestBase {
use CronRunTrait;
/**
* Adds feeds and updates them via cron process.
*/
......
<?php
namespace Drupal\aggregator\Tests;
namespace Drupal\Tests\aggregator\Functional;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\views\Entity\View;
......@@ -132,10 +132,14 @@ public function testFeedPage() {
// 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());
......
<?php
namespace Drupal\aggregator\Tests;
namespace Drupal\Tests\aggregator\Functional;
/**
* Tests the display of a feed on the Aggregator list page.
......
<?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 @@
*/
class FeedLanguageTest extends AggregatorTestBase {
use CronRunTrait;
/**
* Modules to install.
*
......
<?php
namespace Drupal\aggregator\Tests;
namespace Drupal\Tests\aggregator\Functional;
use Drupal\aggregator\Entity\Feed;
/**
......
<?php
namespace Drupal\aggregator\Tests;
namespace Drupal\Tests\aggregator\Functional;
/**
* Update feed test.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment