FeedAdminDisplayTest.php in Drupal 9
File
core/modules/aggregator/tests/src/Functional/FeedAdminDisplayTest.php
View source
<?php
namespace Drupal\Tests\aggregator\Functional;
class FeedAdminDisplayTest extends AggregatorTestBase {
protected $defaultTheme = 'stark';
public function testFeedUpdateFields() {
$scheduled_feed = $this
->createFeed(NULL, [
'refresh' => '900',
]);
$this
->drupalGet('admin/config/services/aggregator');
$this
->assertSession()
->statusCodeEquals(200);
$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');
$this
->assertSession()
->pageTextNotContains('never');
$this
->assertSession()
->pageTextNotContains('imminently');
$this
->assertSession()
->pageTextContains('ago');
$this
->assertSession()
->pageTextContains('left');
$this
->deleteFeed($scheduled_feed);
$non_scheduled_feed = $this
->createFeed(NULL, [
'refresh' => '0',
]);
$this
->drupalGet('admin/config/services/aggregator');
$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');
$this
->assertSession()
->pageTextContains('never');
$this
->assertSession()
->pageTextNotContains('imminently');
$this
->assertSession()
->pageTextContains('ago');
$this
->assertSession()
->pageTextNotContains('left');
}
public function randomMachineName($length = 8) {
$value = parent::randomMachineName($length);
$value = str_replace([
'never',
'imminently',
'ago',
'left',
], 'x', $value);
return $value;
}
}