function AggregatorAdminTest::testOverviewPage in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/aggregator/src/Tests/AggregatorAdminTest.php \Drupal\aggregator\Tests\AggregatorAdminTest::testOverviewPage()
Tests the overview page.
File
- core/
modules/ aggregator/ src/ Tests/ AggregatorAdminTest.php, line 67 - Contains \Drupal\aggregator\Tests\AggregatorAdminTest.
Class
- AggregatorAdminTest
- Tests aggregator admin pages.
Namespace
Drupal\aggregator\TestsCode
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
->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);
$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]);
// 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);
$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]);
}