3 namespace Drupal\Tests\aggregator\Functional;
10 class UpdateFeedTest extends AggregatorTestBase {
13 * Creates a feed and attempts to update it.
15 public function testUpdateFeed() {
16 $remaining_fields = ['title[0][value]', 'url[0][value]', ''];
17 foreach ($remaining_fields as $same_field) {
18 $feed = $this->createFeed();
20 // Get new feed data array and modify newly created feed.
21 $edit = $this->getFeedEditArray();
22 // Change refresh value.
23 $edit['refresh'] = 1800;
24 if (isset($feed->{$same_field}->value)) {
25 $edit[$same_field] = $feed->{$same_field}->value;
27 $this->drupalPostForm('aggregator/sources/' . $feed->id() . '/configure', $edit, t('Save'));
28 $this->assertText(t('The feed @name has been updated.', ['@name' => $edit['title[0][value]']]), format_string('The feed %name has been updated.', ['%name' => $edit['title[0][value]']]));
30 // Verify that the creation message contains a link to a feed.
31 $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', [':href' => 'aggregator/sources/']);
32 $this->assert(isset($view_link), 'The message area contains a link to a feed');
35 $this->assertUrl($feed->url('canonical', ['absolute' => TRUE]));
36 $this->assertTrue($this->uniqueFeed($edit['title[0][value]'], $edit['url[0][value]']), 'The feed is unique.');
39 $this->drupalGet('aggregator/sources/' . $feed->id());
40 $this->assertResponse(200, 'Feed source exists.');
41 $this->assertText($edit['title[0][value]'], 'Page title');
43 // Set correct title so deleteFeed() will work.
44 $feed->title = $edit['title[0][value]'];
47 $this->deleteFeed($feed);