UpdateFeedTest.php in Drupal 9
File
core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php
View source
<?php
namespace Drupal\Tests\aggregator\Functional;
class UpdateFeedTest extends AggregatorTestBase {
protected $defaultTheme = 'stark';
public function testUpdateFeed() {
$remaining_fields = [
'title[0][value]',
'url[0][value]',
'',
];
foreach ($remaining_fields as $same_field) {
$feed = $this
->createFeed();
$edit = $this
->getFeedEditArray();
$edit['refresh'] = 1800;
if (isset($feed->{$same_field}->value)) {
$edit[$same_field] = $feed->{$same_field}->value;
}
$this
->drupalGet('aggregator/sources/' . $feed
->id() . '/configure');
$this
->submitForm($edit, 'Save');
$this
->assertSession()
->pageTextContains('The feed ' . $edit['title[0][value]'] . ' has been updated.');
$this
->assertSession()
->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "aggregator/sources/")]');
$this
->assertSession()
->addressEquals($feed
->toUrl('canonical'));
$this
->assertTrue($this
->uniqueFeed($edit['title[0][value]'], $edit['url[0][value]']), 'The feed is unique.');
$this
->drupalGet('aggregator/sources/' . $feed
->id());
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains($edit['title[0][value]']);
$feed->title = $edit['title[0][value]'];
$this
->deleteFeed($feed);
}
}
}