Version 1
[yaffs-website] / web / core / modules / aggregator / tests / src / Functional / DeleteFeedItemTest.php
1 <?php
2
3 namespace Drupal\Tests\aggregator\Functional;
4
5 /**
6  * Delete feed items from a feed.
7  *
8  * @group aggregator
9  */
10 class DeleteFeedItemTest extends AggregatorTestBase {
11   /**
12    * Tests running "delete items" from 'admin/config/services/aggregator' page.
13    */
14   public function testDeleteFeedItem() {
15     // Create a bunch of test feeds.
16     $feed_urls = [];
17     // No last-modified, no etag.
18     $feed_urls[] = \Drupal::url('aggregator_test.feed', [], ['absolute' => TRUE]);
19     // Last-modified, but no etag.
20     $feed_urls[] = \Drupal::url('aggregator_test.feed', ['use_last_modified' => 1], ['absolute' => TRUE]);
21     // No Last-modified, but etag.
22     $feed_urls[] = \Drupal::url('aggregator_test.feed', ['use_last_modified' => 0, 'use_etag' => 1], ['absolute' => TRUE]);
23     // Last-modified and etag.
24     $feed_urls[] = \Drupal::url('aggregator_test.feed', ['use_last_modified' => 1, 'use_etag' => 1], ['absolute' => TRUE]);
25
26     foreach ($feed_urls as $feed_url) {
27       $feed = $this->createFeed($feed_url);
28       // Update and delete items two times in a row to make sure that removal
29       // resets all 'modified' information (modified, etag, hash) and allows for
30       // immediate update. There's 8 items in the feed, but one has an empty
31       // title and is skipped.
32       $this->updateAndDelete($feed, 7);
33       $this->updateAndDelete($feed, 7);
34       $this->updateAndDelete($feed, 7);
35       // Delete feed.
36       $this->deleteFeed($feed);
37     }
38   }
39
40 }