function AggregatorAdminTest::testOverviewPage
Same name in other branches
- 9 core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php \Drupal\Tests\aggregator\Functional\AggregatorAdminTest::testOverviewPage()
Tests the overview page.
File
-
core/
modules/ aggregator/ tests/ src/ Functional/ AggregatorAdminTest.php, line 69
Class
- AggregatorAdminTest
- Tests aggregator admin pages.
Namespace
Drupal\Tests\aggregator\FunctionalCode
public function testOverviewPage() {
$feed = $this->createFeed($this->getRSS091Sample());
$this->drupalGet('admin/config/services/aggregator');
$result = $this->xpath('//table/tbody/tr');
// Check if the amount of feeds in the overview matches the amount created.
$this->assertCount(1, $result, 'Created feed is found in the overview');
// Check if the fields in the table match with what's expected.
$link = $this->xpath('//table/tbody/tr//td[1]/a');
$this->assertEquals($feed->label(), $link[0]->getText());
$count = $this->container
->get('entity_type.manager')
->getStorage('aggregator_item')
->getItemCount($feed);
$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.
$link = $this->xpath('//table/tbody/tr//td[1]/a');
$this->assertEquals($feed->label(), $link[0]->getText());
$count = $this->container
->get('entity_type.manager')
->getStorage('aggregator_item')
->getItemCount($feed);
$td = $this->xpath('//table/tbody/tr//td[2]');
$this->assertEquals(\Drupal::translation()->formatPlural($count, '1 item', '@count items'), $td[0]->getText());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.