diff --git a/core/modules/aggregator/src/Plugin/FetcherInterface.php b/core/modules/aggregator/src/Plugin/FetcherInterface.php index be9734e..9d08a3a 100644 --- a/core/modules/aggregator/src/Plugin/FetcherInterface.php +++ b/core/modules/aggregator/src/Plugin/FetcherInterface.php @@ -34,7 +34,7 @@ * Download the data at the URL and expose it * to other modules by attaching it to $feed->source_string. * - * @return + * @return bool * TRUE if fetching was successful, FALSE otherwise. */ public function fetch(FeedInterface $feed); diff --git a/core/modules/aggregator/src/Plugin/QueueWorker/AggregatorRefresh.php b/core/modules/aggregator/src/Plugin/QueueWorker/AggregatorRefresh.php index d3267eb..5ec1f83 100644 --- a/core/modules/aggregator/src/Plugin/QueueWorker/AggregatorRefresh.php +++ b/core/modules/aggregator/src/Plugin/QueueWorker/AggregatorRefresh.php @@ -11,6 +11,8 @@ use Drupal\Core\Queue\QueueWorkerBase; /** + * Ensures the feed is updated. + * * @QueueWorker( * id = "aggregator_feeds", * title = @Translation("Aggregator refresh"), diff --git a/core/modules/aggregator/src/Plugin/aggregator/fetcher/DefaultFetcher.php b/core/modules/aggregator/src/Plugin/aggregator/fetcher/DefaultFetcher.php index a3bdce0..be12c43 100644 --- a/core/modules/aggregator/src/Plugin/aggregator/fetcher/DefaultFetcher.php +++ b/core/modules/aggregator/src/Plugin/aggregator/fetcher/DefaultFetcher.php @@ -96,7 +96,6 @@ public function fetch(FeedInterface $feed) { $feed->http_headers = $response->getHeaders(); // Update the feed URL in case of a 301 redirect. - if ($response->getEffectiveUrl() != $feed->getUrl()) { $feed->setUrl($response->getEffectiveUrl()); } diff --git a/core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php b/core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php index cadd84b..800b5b0 100644 --- a/core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php +++ b/core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php @@ -192,8 +192,8 @@ public function process(FeedInterface $feed) { } foreach ($feed->items as $item) { // @todo: The default entity view builder always returns an empty - // array, which is ignored in aggregator_save_item() currently. Should - // probably be fixed. + // array, which is ignored in aggregator_save_item() currently. Should + // probably be fixed. if (empty($item['title'])) { continue; } diff --git a/core/modules/aggregator/src/Plugin/views/field/TitleLink.php b/core/modules/aggregator/src/Plugin/views/field/TitleLink.php index fa56ab2..ba05199 100644 --- a/core/modules/aggregator/src/Plugin/views/field/TitleLink.php +++ b/core/modules/aggregator/src/Plugin/views/field/TitleLink.php @@ -15,8 +15,9 @@ use Drupal\views\ViewExecutable; /** - * Defines a field handler that turns an item's title into a clickable link to - * the original source article. + * Defines a field handler that turns an item's title into a clickable link. + * + * The link refers to the original source article. * * @ingroup views_field_handlers * diff --git a/core/modules/aggregator/src/Tests/AggregatorTestBase.php b/core/modules/aggregator/src/Tests/AggregatorTestBase.php index c0630ce..3c5a452 100644 --- a/core/modules/aggregator/src/Tests/AggregatorTestBase.php +++ b/core/modules/aggregator/src/Tests/AggregatorTestBase.php @@ -30,6 +30,9 @@ */ public static $modules = array('node', 'aggregator', 'aggregator_test', 'views'); + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); @@ -237,7 +240,7 @@ public function uniqueFeed($feed_name, $feed_url) { * @return string * Path to valid OPML file. */ - public function getValidOpml($feeds) { + public function getValidOpml(array $feeds) { // Properly escape URLs so that XML parsers don't choke on them. foreach ($feeds as &$feed) { $feed['url[0][value]'] = htmlspecialchars($feed['url[0][value]']); @@ -309,16 +312,34 @@ public function getEmptyOpml() { return file_unmanaged_save_data($opml, $path); } + /** + * Returns a example RSS091 feed. + * + * @return string + * Path to the feed. + */ public function getRSS091Sample() { return $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'aggregator') . '/tests/modules/aggregator_test/aggregator_test_rss091.xml'; } + /** + * Returns a example Atom feed. + * + * @return string + * Path to the feed. + */ public function getAtomSample() { // The content of this sample ATOM feed is based directly off of the // example provided in RFC 4287. return $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'aggregator') . '/tests/modules/aggregator_test/aggregator_test_atom.xml'; } + /** + * Returns a example feed. + * + * @return string + * Path to the feed. + */ public function getHtmlEntitiesSample() { return $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'aggregator') . '/tests/modules/aggregator_test/aggregator_test_title_entities.xml'; } @@ -348,7 +369,7 @@ public function enableTestPlugins() { ->set('parser', 'aggregator_test_parser') ->set('processors', array( 'aggregator_test_processor' => 'aggregator_test_processor', - 'aggregator' => 'aggregator' + 'aggregator' => 'aggregator', )) ->save(); } diff --git a/core/modules/aggregator/src/Tests/FeedFetcherPluginTest.php b/core/modules/aggregator/src/Tests/FeedFetcherPluginTest.php index d98f0c7..618104f 100644 --- a/core/modules/aggregator/src/Tests/FeedFetcherPluginTest.php +++ b/core/modules/aggregator/src/Tests/FeedFetcherPluginTest.php @@ -16,6 +16,9 @@ */ class FeedFetcherPluginTest extends AggregatorTestBase { + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); // Enable test plugins. diff --git a/core/modules/aggregator/src/Tests/FeedLanguageTest.php b/core/modules/aggregator/src/Tests/FeedLanguageTest.php index 1f48bb1..d259c82 100644 --- a/core/modules/aggregator/src/Tests/FeedLanguageTest.php +++ b/core/modules/aggregator/src/Tests/FeedLanguageTest.php @@ -30,6 +30,9 @@ class FeedLanguageTest extends AggregatorTestBase { */ protected $langcodes = array(); + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); diff --git a/core/modules/aggregator/src/Tests/FeedParserTest.php b/core/modules/aggregator/src/Tests/FeedParserTest.php index 2e79ef3..371b10f 100644 --- a/core/modules/aggregator/src/Tests/FeedParserTest.php +++ b/core/modules/aggregator/src/Tests/FeedParserTest.php @@ -16,6 +16,10 @@ * @group aggregator */ class FeedParserTest extends AggregatorTestBase { + + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); // Do not delete old aggregator items during these tests, since our sample diff --git a/core/modules/aggregator/src/Tests/UpdateFeedItemTest.php b/core/modules/aggregator/src/Tests/UpdateFeedItemTest.php index 046fd70..e100d64 100644 --- a/core/modules/aggregator/src/Tests/UpdateFeedItemTest.php +++ b/core/modules/aggregator/src/Tests/UpdateFeedItemTest.php @@ -17,7 +17,7 @@ class UpdateFeedItemTest extends AggregatorTestBase { /** * Tests running "update items" from 'admin/config/services/aggregator' page. */ - function testUpdateFeedItem() { + public function testUpdateFeedItem() { $this->createSampleNodes(); // Create a feed and test updating feed items if possible. diff --git a/core/modules/aggregator/src/Tests/UpdateFeedTest.php b/core/modules/aggregator/src/Tests/UpdateFeedTest.php index 16d47d9..71ca7de 100644 --- a/core/modules/aggregator/src/Tests/UpdateFeedTest.php +++ b/core/modules/aggregator/src/Tests/UpdateFeedTest.php @@ -23,7 +23,8 @@ public function testUpdateFeed() { // Get new feed data array and modify newly created feed. $edit = $this->getFeedEditArray(); - $edit['refresh'] = 1800; // Change refresh value. + // Change refresh value. + $edit['refresh'] = 1800; if (isset($feed->{$same_field}->value)) { $edit[$same_field] = $feed->{$same_field}->value; } @@ -39,8 +40,10 @@ public function testUpdateFeed() { $this->assertResponse(200, 'Feed source exists.'); $this->assertText($edit['title[0][value]'], 'Page title'); + // Set correct title so deleteFeed() will work. + $feed->title = $edit['title[0][value]']; + // Delete feed. - $feed->title = $edit['title[0][value]']; // Set correct title so deleteFeed() will work. $this->deleteFeed($feed); } }