3 namespace Drupal\aggregator\Tests;
10 class UpdateFeedTest extends AggregatorTestBase {
12 * Creates a feed and attempts to update it.
14 public function testUpdateFeed() {
15 $remaining_fields = ['title[0][value]', 'url[0][value]', ''];
16 foreach ($remaining_fields as $same_field) {
17 $feed = $this->createFeed();
19 // Get new feed data array and modify newly created feed.
20 $edit = $this->getFeedEditArray();
21 // Change refresh value.
22 $edit['refresh'] = 1800;
23 if (isset($feed->{$same_field}->value)) {
24 $edit[$same_field] = $feed->{$same_field}->value;
26 $this->drupalPostForm('aggregator/sources/' . $feed->id() . '/configure', $edit, t('Save'));
27 $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]']]));
29 // Verify that the creation message contains a link to a feed.
30 $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', [':href' => 'aggregator/sources/']);
31 $this->assert(isset($view_link), 'The message area contains a link to a feed');
34 $this->assertUrl($feed->url('canonical', ['absolute' => TRUE]));
35 $this->assertTrue($this->uniqueFeed($edit['title[0][value]'], $edit['url[0][value]']), 'The feed is unique.');
38 $this->drupalGet('aggregator/sources/' . $feed->id());
39 $this->assertResponse(200, 'Feed source exists.');
40 $this->assertText($edit['title[0][value]'], 'Page title');
42 // Set correct title so deleteFeed() will work.
43 $feed->title = $edit['title[0][value]'];
46 $this->deleteFeed($feed);