class FeedAdminDisplayTest
Same name and namespace in other branches
- 8.9.x core/modules/aggregator/tests/src/Functional/FeedAdminDisplayTest.php \Drupal\Tests\aggregator\Functional\FeedAdminDisplayTest
Tests the display of a feed on the Aggregator list page.
@group aggregator @group legacy
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\aggregator\Functional\AggregatorTestBase extends \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\aggregator\Functional\FeedAdminDisplayTest extends \Drupal\Tests\aggregator\Functional\AggregatorTestBase
- class \Drupal\Tests\aggregator\Functional\AggregatorTestBase extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of FeedAdminDisplayTest
File
-
core/
modules/ aggregator/ tests/ src/ Functional/ FeedAdminDisplayTest.php, line 11
Namespace
Drupal\Tests\aggregator\FunctionalView source
class FeedAdminDisplayTest extends AggregatorTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests the "Next update" and "Last update" fields.
*/
public function testFeedUpdateFields() {
// Create scheduled feed.
$scheduled_feed = $this->createFeed(NULL, [
'refresh' => '900',
]);
$this->drupalGet('admin/config/services/aggregator');
$this->assertSession()
->statusCodeEquals(200);
// The scheduled feed shows that it has not been updated yet and is
// scheduled.
$this->assertSession()
->pageTextContains('never');
$this->assertSession()
->pageTextContains('imminently');
$this->assertSession()
->pageTextNotContains('ago');
$this->assertSession()
->pageTextNotContains('left');
$this->updateFeedItems($scheduled_feed);
$this->drupalGet('admin/config/services/aggregator');
// After the update, an interval should be displayed on both last updated
// and next update.
$this->assertSession()
->pageTextNotContains('never');
$this->assertSession()
->pageTextNotContains('imminently');
$this->assertSession()
->pageTextContains('ago');
$this->assertSession()
->pageTextContains('left');
// Delete scheduled feed.
$this->deleteFeed($scheduled_feed);
// Create non-scheduled feed.
$non_scheduled_feed = $this->createFeed(NULL, [
'refresh' => '0',
]);
$this->drupalGet('admin/config/services/aggregator');
// The non scheduled feed shows that it has not been updated yet.
$this->assertSession()
->pageTextContains('never');
$this->assertSession()
->pageTextNotContains('imminently');
$this->assertSession()
->pageTextNotContains('ago');
$this->assertSession()
->pageTextNotContains('left');
$this->updateFeedItems($non_scheduled_feed);
$this->drupalGet('admin/config/services/aggregator');
// After the feed update, we still need to see "never" as next update label.
// Last update will show an interval.
$this->assertSession()
->pageTextContains('never');
$this->assertSession()
->pageTextNotContains('imminently');
$this->assertSession()
->pageTextContains('ago');
$this->assertSession()
->pageTextNotContains('left');
}
/**
* {@inheritdoc}
*/
public function randomMachineName($length = 8) {
$value = parent::randomMachineName($length);
// See expected values in testFeedUpdateFields().
$value = str_replace([
'never',
'imminently',
'ago',
'left',
], 'x', $value);
return $value;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.