diff --git a/core/modules/aggregator/aggregator.module b/core/modules/aggregator/aggregator.module index 045c156..704f5b2 100644 --- a/core/modules/aggregator/aggregator.module +++ b/core/modules/aggregator/aggregator.module @@ -205,7 +205,7 @@ function aggregator_cron() { $feed = aggregator_feed_load($fid); if ($queue->createItem($feed)) { // Add timestamp to avoid queueing item more than once. - $feed->queued->value = REQUEST_TIME; + $feed->setQueuedTime(REQUEST_TIME); $feed->save(); } } @@ -289,7 +289,7 @@ function aggregator_save_category($edit) { */ function aggregator_refresh(Feed $feed) { // Store feed URL to track changes. - $feed_url = $feed->url->value; + $feed_url = $feed->getUrl(); $config = \Drupal::config('aggregator.settings'); // Fetch the feed. @@ -320,21 +320,21 @@ function aggregator_refresh(Feed $feed) { // data. If both are equal we say that feed is not updated. $hash = hash('sha256', $feed->source_string); - if ($success && ($feed->hash->value != $hash)) { + if ($success && ($feed->getHash() != $hash)) { // Parse the feed. $parser_manager = \Drupal::service('plugin.manager.aggregator.parser'); try { if ($parser_manager->createInstance($config->get('parser'))->parse($feed)) { - if (empty($feed->link->value)) { - $feed->link->value = $feed->url->value; + if ($feed->getWebsiteUrl()) { + $feed->setWebsiteUrl($feed->getUrl()); } - $feed->hash->value = $hash; + $feed->setHash($hash); // Update feed with parsed data. $feed->save(); // Log if feed URL has changed. - if ($feed->url->value != $feed_url) { - watchdog('aggregator', 'Updated URL for feed %title to %url.', array('%title' => $feed->label(), '%url' => $feed->url->value)); + if ($feed->getUrl() != $feed_url) { + watchdog('aggregator', 'Updated URL for feed %title to %url.', array('%title' => $feed->label(), '%url' => $feed->getUrl())); } watchdog('aggregator', 'There is new syndicated content from %site.', array('%site' => $feed->label())); @@ -357,8 +357,8 @@ function aggregator_refresh(Feed $feed) { } // Regardless of successful or not, indicate that this feed has been checked. - $feed->checked->value = REQUEST_TIME; - $feed->queued->value = 0; + $feed->setLastCheckedTime(REQUEST_TIME); + $feed->setQueuedTime(0); $feed->save(); // Processing is done, call postProcess on enabled processors. diff --git a/core/modules/aggregator/aggregator.pages.inc b/core/modules/aggregator/aggregator.pages.inc index e364aee..d952916 100644 --- a/core/modules/aggregator/aggregator.pages.inc +++ b/core/modules/aggregator/aggregator.pages.inc @@ -217,27 +217,27 @@ function template_preprocess_aggregator_feed_source(&$variables) { $feed_icon = array( '#theme' => 'feed_icon', - '#url' => $feed->url->value, + '#url' => $feed->getUrl(), '#title' => t('!title feed', array('!title' => $feed->label())), ); $variables['source_icon'] = drupal_render($feed_icon); - if (!empty($feed->image->value) && $feed->label() && !empty($feed->link->value)) { + if ($feed->getImage() && $feed->label() && $feed->getWebsiteUrl()) { $image = array( '#theme' => 'image', - '#path' => $feed->image->value, - '#alt' => $feed->title->value, + '#path' => $feed->getImage(), + '#alt' => $feed->label(), ); - $variables['source_image'] = l($image, $feed->link->value, array('html' => TRUE, 'attributes' => array('class' => 'feed-image'))); + $variables['source_image'] = l($image, $feed->getWebsiteUrl(), array('html' => TRUE, 'attributes' => array('class' => 'feed-image'))); } else { $variables['source_image'] = ''; } - $variables['source_description'] = aggregator_filter_xss($feed->description->value); - $variables['source_url'] = check_url(url($feed->link->value, array('absolute' => TRUE))); + $variables['source_description'] = aggregator_filter_xss($feed->getDescription()); + $variables['source_url'] = check_url(url($feed->getWebsiteUrl(), array('absolute' => TRUE))); if ($feed->checked) { - $variables['last_checked'] = t('@time ago', array('@time' => format_interval(REQUEST_TIME - $feed->checked->value))); + $variables['last_checked'] = t('@time ago', array('@time' => format_interval(REQUEST_TIME - $feed->getLastCheckedTime()))); } else { $variables['last_checked'] = t('never'); diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Entity/Feed.php b/core/modules/aggregator/lib/Drupal/aggregator/Entity/Feed.php index ea12340..074487a 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Entity/Feed.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Entity/Feed.php @@ -41,121 +41,6 @@ class Feed extends ContentEntityBase implements FeedInterface { /** - * The feed ID. - * - * @todo rename to id. - * - * @var \Drupal\Core\Field\FieldItemListInterface - */ - public $fid; - - /** - * Title of the feed. - * - * @var \Drupal\Core\Field\FieldItemListInterface - */ - public $title; - - /** - * The feed language code. - * - * @var \Drupal\Core\Field\FieldItemListInterface - */ - public $langcode; - - /** - * URL to the feed. - * - * @var \Drupal\Core\Field\FieldItemListInterface - */ - public $url; - - /** - * How often to check for new feed items, in seconds. - * - * @var \Drupal\Core\Field\FieldItemListInterface - */ - public $refresh; - - /** - * Last time feed was checked for new items, as Unix timestamp. - * - * @var \Drupal\Core\Field\FieldItemListInterface - */ - public $checked; - - /** - * Time when this feed was queued for refresh, 0 if not queued. - * - * @var \Drupal\Core\Field\FieldItemListInterface - */ - public $queued; - - /** - * The parent website of the feed; comes from the element in the feed. - * - * @var \Drupal\Core\Field\FieldItemListInterface - */ - public $link ; - - /** - * The parent website's description; - * comes from the element in the feed. - * - * @var \Drupal\Core\Field\FieldItemListInterface - */ - public $description; - - /** - * An image representing the feed. - * - * @var \Drupal\Core\Field\FieldItemListInterface - */ - public $image; - - /** - * Calculated hash of the feed data, used for validating cache. - * - * @var \Drupal\Core\Field\FieldItemListInterface - */ - public $hash; - - /** - * Entity tag HTTP response header, used for validating cache. - * - * @var \Drupal\Core\Field\FieldItemListInterface - */ - public $etag; - - /** - * When the feed was last modified, as a Unix timestamp. - * - * @var \Drupal\Core\Field\FieldItemListInterface - */ - public $modified; - - /** - * {@inheritdoc} - */ - public function init() { - parent::init(); - - // We unset all defined properties, so magic getters apply. - unset($this->fid); - unset($this->title); - unset($this->url); - unset($this->refresh); - unset($this->checked); - unset($this->queued); - unset($this->link); - unset($this->description); - unset($this->image); - unset($this->hash); - unset($this->etag); - unset($this->modified); - } - - /** * Implements Drupal\Core\Entity\EntityInterface::id(). */ public function id() { @@ -178,11 +63,13 @@ public function removeItems() { $manager->createInstance($id)->remove($this); } // Reset feed. - $this->checked->value = 0; - $this->hash->value = ''; - $this->etag->value = ''; - $this->modified->value = 0; + $this->setLastCheckedTime(0); + $this->setHash(''); + $this->setEtag(''); + $this->setLastModified(0); $this->save(); + + return $this; } /** @@ -320,4 +207,162 @@ public static function baseFieldDefinitions($entity_type) { return $fields; } + /** + * {@inheritdoc} + */ + public function getUrl() { + return $this->get('url')->value; + } + + /** + * {@inheritdoc} + */ + public function getRefreshRate() { + return $this->get('refresh')->value; + } + + /** + * {@inheritdoc} + */ + public function getLastCheckedTime() { + return $this->get('checked')->value; + } + + /** + * {@inheritdoc} + */ + public function getQueuedTime() { + return $this->get('queued')->value; + } + + /** + * {@inheritdoc} + */ + public function getWebsiteUrl() { + return $this->get('link')->value; + } + + /** + * {@inheritdoc} + */ + public function getDescription() { + return $this->get('description')->value; + } + + /** + * {@inheritdoc} + */ + public function getImage() { + return $this->get('image')->value; + } + + /** + * {@inheritdoc} + */ + public function getHash() { + return $this->get('hash')->value; + } + + /** + * {@inheritdoc} + */ + public function getEtag() { + return $this->get('etag')->value; + } + + /** + * {@inheritdoc} + */ + public function getLastModified() { + return $this->get('modified')->value; + } + + /** + * {@inheritdoc} + */ + public function setTitle($title) { + $this->set('title', $title); + return $this; + } + + /** + * {@inheritdoc} + */ + public function setUrl($url) { + $this->set('url', $url); + return $this; + } + + /** + * {@inheritdoc} + */ + public function setRefreshRate($refresh) { + $this->set('refresh', $refresh); + return $this; + } + + /** + * {@inheritdoc} + */ + public function setLastCheckedTime($checked) { + $this->set('checked', $checked); + return $this; + } + + /** + * {@inheritdoc} + */ + public function setQueuedTime($queued) { + $this->set('queued', $queued); + return $this; + } + + /** + * {@inheritdoc} + */ + public function setWebsiteUrl($link) { + $this->set('link', $link); + return $this; + } + + /** + * {@inheritdoc} + */ + public function setDescription($description) { + $this->set('description', $description); + return $this; + } + + /** + * {@inheritdoc} + */ + public function setImage($image) { + $this->set('image', $image); + return $this; + } + + /** + * {@inheritdoc} + */ + public function setHash($hash) { + $this->set('hash', $hash); + return $this; + } + + /** + * {@inheritdoc} + */ + public function setEtag($etag) { + $this->set('etag', $etag); + return $this; + } + + /** + * {@inheritdoc} + */ + public function setLastModified($modified) { + $this->set('modified', $modified); + return $this; + } + } diff --git a/core/modules/aggregator/lib/Drupal/aggregator/FeedFormController.php b/core/modules/aggregator/lib/Drupal/aggregator/FeedFormController.php index 0ca5bef..5310220 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/FeedFormController.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/FeedFormController.php @@ -83,14 +83,14 @@ public function form(array $form, array &$form_state) { $form['url'] = array( '#type' => 'url', '#title' => $this->t('URL'), - '#default_value' => $feed->url->value, + '#default_value' => $feed->getUrl(), '#maxlength' => NULL, '#description' => $this->t('The fully-qualified URL of the feed.'), '#required' => TRUE, ); $form['refresh'] = array('#type' => 'select', '#title' => $this->t('Update interval'), - '#default_value' => $feed->refresh->value, + '#default_value' => $feed->getRefreshRate(), '#options' => $period, '#description' => $this->t('The length of time between feed updates. Requires a correctly configured cron maintenance task.', array('@cron' => url('admin/reports/status'))), ); @@ -130,8 +130,8 @@ public function validate(array $form, array &$form_state) { if (strcasecmp($item->title, $feed->label()) == 0) { form_set_error('title', $this->t('A feed named %feed already exists. Enter a unique title.', array('%feed' => $feed->label()))); } - if (strcasecmp($item->url, $feed->url->value) == 0) { - form_set_error('url', $this->t('A feed with this URL %url already exists. Enter a unique URL.', array('%url' => $feed->url->value))); + if (strcasecmp($item->url, $feed->getUrl()) == 0) { + form_set_error('url', $this->t('A feed with this URL %url already exists. Enter a unique URL.', array('%url' => $feed->getUrl()))); } } parent::validate($form, $form_state); diff --git a/core/modules/aggregator/lib/Drupal/aggregator/FeedInterface.php b/core/modules/aggregator/lib/Drupal/aggregator/FeedInterface.php index 3cccaec..adabe96 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/FeedInterface.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/FeedInterface.php @@ -15,7 +15,211 @@ interface FeedInterface extends ContentEntityInterface { /** + * Sets the title of the feed. + * + * @param string $title + * The short title of the feed. + * + * @return \Drupal\aggregator\FeedInterface + * The class instance that this method is called on. + */ + public function setTitle($title); + + /** + * Returns the url to the feed. + * + * @return string + * The url to the feed. + */ + public function getUrl(); + + /** + * Sets the url to the feed. + * + * @param string $url + * A string containing the url of the feed. + * + * @return \Drupal\aggregator\FeedInterface + * The class instance that this method is called on. + */ + public function setUrl($url); + + /** + * Returns the refresh rate of the feed in seconds. + * + * @return int + * The refresh rate of the feed in seconds. + */ + public function getRefreshRate(); + + /** + * Sets the refresh rate of the feed in seconds. + * + * @param int $refresh + * The refresh rate of the feed in seconds. + * + * @return \Drupal\aggregator\FeedInterface + * The class instance that this method is called on. + */ + public function setRefreshRate($refresh); + + /** + * Returns the last time where the feed was checked for new items. + * + * @return int + * The timestamp when new items were last checked for. + */ + public function getLastCheckedTime(); + + /** + * Sets the time when this feed was queued for refresh, 0 if not queued. + * + * @param int $checked + * The timestamp of the last refresh. + * + * @return \Drupal\aggregator\FeedInterface + * The class instance that this method is called on. + */ + public function setLastCheckedTime($checked); + + /** + * Returns the time when this feed was queued for refresh, 0 if not queued. + * + * @return int + * The timestamp of the last refresh. + */ + public function getQueuedTime(); + + /** + * Sets the time when this feed was queued for refresh, 0 if not queued. + * + * @param int $queued + * The timestamp of the last refresh. + * + * @return \Drupal\aggregator\FeedInterface + * The class instance that this method is called on. + */ + public function setQueuedTime($queued); + + /** + * Returns the parent website of the feed. + * + * @return string + * The parent website of the feed. + */ + public function getWebsiteUrl(); + + /** + * Sets the parent website of the feed. + * + * @param string $link + * A string containing the parent website of the feed. + * + * @return \Drupal\aggregator\FeedInterface + * The class instance that this method is called on. + */ + public function setWebsiteUrl($link); + + /** + * Returns the description of the feed. + * + * @return string + * The description of the feed. + */ + public function getDescription(); + + /** + * Sets the description of the feed. + * + * @param string $description + * The description of the feed. + * + * @return \Drupal\aggregator\FeedInterface + * The class instance that this method is called on. + */ + public function setDescription($description); + + /** + * Returns the primary image attached to the feed. + * + * @return string + * The URL of the primary image attached to the feed. + */ + public function getImage(); + + /** + * Sets the primary image attached to the feed. + * + * @param string $image + * An image URL. + * + * @return \Drupal\aggregator\FeedInterface + * The class instance that this method is called on. + */ + public function setImage($image); + + /** + * Returns the calculated hash of the feed data, used for validating cache. + * + * @return string + * The calculated hash of the feed data. + */ + public function getHash(); + + /** + * Sets the calculated hash of the feed data, used for validating cache. + * + * @param string $hash + * A string containing the calculated hash of the feed. + * + * @return \Drupal\aggregator\FeedInterface + * The class instance that this method is called on. + */ + public function setHash($hash); + + /** + * Returns the entity tag HTTP response header, used for validating cache. + * + * @return string + * The entity tag HTTP response header. + */ + public function getEtag(); + + /** + * Sets the entity tag HTTP response header, used for validating cache. + * + * @param string $etag + * A string containing the entity tag HTTP response header. + * + * @return \Drupal\aggregator\FeedInterface + * The class instance that this method is called on. + */ + public function setEtag($etag); + + /** + * Return when the feed was modified last time. + * + * @return int + * The timestamp of the last time the feed was modified. + */ + public function getLastModified(); + + /** + * Sets the last modification of the feed. + * + * @param int $modified + * The timestamp when the feed was modified. + * + * @return \Drupal\aggregator\FeedInterface + * The class instance that this method is called on. + */ + public function setLastModified($modified); + + /** * Removes all items from a feed. + * + * @return \Drupal\aggregator\FeedInterface + * The class instance that this method is called on. */ public function removeItems(); diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Form/OpmlFeedAdd.php b/core/modules/aggregator/lib/Drupal/aggregator/Form/OpmlFeedAdd.php index abf1cad..f51530f 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Form/OpmlFeedAdd.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Form/OpmlFeedAdd.php @@ -198,8 +198,8 @@ public function submitForm(array &$form, array &$form_state) { drupal_set_message($this->t('A feed named %title already exists.', array('%title' => $old->label())), 'warning'); continue 2; } - if (strcasecmp($old->url->value, $feed['url']) == 0) { - drupal_set_message($this->t('A feed with the URL %url already exists.', array('%url' => $old->url->value)), 'warning'); + if (strcasecmp($old->getUrl(), $feed['url']) == 0) { + drupal_set_message($this->t('A feed with the URL %url already exists.', array('%url' => $old->getUrl())), 'warning'); continue 2; } } diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/FetcherInterface.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/FetcherInterface.php index f497b36..6bb8179 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/FetcherInterface.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/FetcherInterface.php @@ -25,7 +25,7 @@ * * @param \Drupal\aggregator\Entity\Feed $feed * A feed object representing the resource to be downloaded. - * $feed->url->value contains the link to the feed. + * $feed->getUrl() contains the link to the feed. * Download the data at the URL and expose it * to other modules by attaching it to $feed->source_string. * diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/fetcher/DefaultFetcher.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/fetcher/DefaultFetcher.php index 38306d7..cd8f980 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/fetcher/DefaultFetcher.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/fetcher/DefaultFetcher.php @@ -60,15 +60,15 @@ public static function create(ContainerInterface $container, array $configuratio * {@inheritdoc} */ public function fetch(Feed $feed) { - $request = $this->httpClient->get($feed->url->value); + $request = $this->httpClient->get($feed->getUrl()); $feed->source_string = FALSE; // Generate conditional GET headers. - if ($feed->etag->value) { - $request->addHeader('If-None-Match', $feed->etag->value); + if ($feed->getEtag()) { + $request->addHeader('If-None-Match', $feed->getEtag()); } - if ($feed->modified->value) { - $request->addHeader('If-Modified-Since', gmdate(DATE_RFC1123, $feed->modified->value)); + if ($feed->getLastModified()) { + $request->addHeader('If-Modified-Since', gmdate(DATE_RFC1123, $feed->getLastModified())); } try { @@ -81,14 +81,14 @@ public function fetch(Feed $feed) { } $feed->source_string = $response->getBody(TRUE); - $feed->etag = $response->getEtag(); - $feed->modified = strtotime($response->getLastModified()); + $feed->setEtag($response->getEtag()); + $feed->setLastModified(strtotime($response->getLastModified())); $feed->http_headers = $response->getHeaders(); // Update the feed URL in case of a 301 redirect. - if ($response->getEffectiveUrl() != $feed->url->value) { - $feed->url->value = $response->getEffectiveUrl(); + if ($response->getEffectiveUrl() != $feed->getUrl()) { + $feed->setUrl($response->getEffectiveUrl()); } return TRUE; } diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/parser/DefaultParser.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/parser/DefaultParser.php index 9b2bcb0..9ed1b7c 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/parser/DefaultParser.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/parser/DefaultParser.php @@ -44,10 +44,10 @@ public function parse(Feed $feed) { return FALSE; } - $feed->link->value = $channel->getLink(); - $feed->description->value = $channel->getDescription(); + $feed->setWebsiteUrl($channel->getLink()); + $feed->setDescription($channel->getDescription()); if ($image = $channel->getImage()) { - $feed->image->value = $image['uri']; + $feed->setImage($image['uri']); } // Initialize items array. $feed->items = array(); diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Tests/AddFeedTest.php b/core/modules/aggregator/lib/Drupal/aggregator/Tests/AddFeedTest.php index 6d27c91..71078fb 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Tests/AddFeedTest.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Tests/AddFeedTest.php @@ -27,7 +27,7 @@ function testAddFeed() { // Check feed data. $this->assertEqual($this->getUrl(), url('admin/config/services/aggregator/add/feed', array('absolute' => TRUE)), 'Directed to correct url.'); - $this->assertTrue($this->uniqueFeed($feed->label(), $feed->url->value), 'The feed is unique.'); + $this->assertTrue($this->uniqueFeed($feed->label(), $feed->getUrl()), 'The feed is unique.'); // Check feed source. $this->drupalGet('aggregator/sources/' . $feed->id()); @@ -55,8 +55,8 @@ function testAddLongFeed() { $feed_2 = $this->createFeed($long_url_2); // Check feed data. - $this->assertTrue($this->uniqueFeed($feed->label(), $feed->url->value), 'The first long URL feed is unique.'); - $this->assertTrue($this->uniqueFeed($feed_2->label(), $feed_2->url->value), 'The second long URL feed is unique.'); + $this->assertTrue($this->uniqueFeed($feed->label(), $feed->getUrl()), 'The first long URL feed is unique.'); + $this->assertTrue($this->uniqueFeed($feed_2->label(), $feed_2->getUrl()), 'The second long URL feed is unique.'); // Check feed source. $this->drupalGet('aggregator/sources/' . $feed->id()); diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php b/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php index 7fb55b6..745baa7 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php @@ -154,8 +154,8 @@ function getDefaultFeedItemCount() { */ function updateFeedItems(Feed $feed, $expected_count = NULL) { // First, let's ensure we can get to the rss xml. - $this->drupalGet($feed->url->value); - $this->assertResponse(200, format_string('!url is reachable.', array('!url' => $feed->url->value))); + $this->drupalGet($feed->getUrl()); + $this->assertResponse(200, format_string('!url is reachable.', array('!url' => $feed->getUrl()))); // Attempt to access the update link directly without an access token. $this->drupalGet('admin/config/services/aggregator/update/' . $feed->id()); diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Tests/CategorizeFeedTest.php b/core/modules/aggregator/lib/Drupal/aggregator/Tests/CategorizeFeedTest.php index 344c8ba..3ba60fc 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Tests/CategorizeFeedTest.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Tests/CategorizeFeedTest.php @@ -43,7 +43,7 @@ function testCategorizeFeed() { } $feed->save(); - $db_fid = db_query("SELECT fid FROM {aggregator_feed} WHERE title = :title AND url = :url", array(':title' => $feed->label(), ':url' => $feed->url->value))->fetchField(); + $db_fid = db_query("SELECT fid FROM {aggregator_feed} WHERE title = :title AND url = :url", array(':title' => $feed->label(), ':url' => $feed->getUrl()))->fetchField(); $db_feed = aggregator_feed_load($db_fid); // Assert the feed has two categories. diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Tests/FeedFetcherPluginTest.php b/core/modules/aggregator/lib/Drupal/aggregator/Tests/FeedFetcherPluginTest.php index ac254e6..936905b 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Tests/FeedFetcherPluginTest.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Tests/FeedFetcherPluginTest.php @@ -42,7 +42,7 @@ public function testfetch() { // Remove items and restore checked property to 0. $this->removeFeedItems($feed); // Change its name and try again. - $feed->title->value = 'Do not fetch'; + $feed->setTitle('Do not fetch'); $feed->save(); $this->updateFeedItems($feed); // Fetch should fail due to feed name. diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Tests/FeedParserTest.php b/core/modules/aggregator/lib/Drupal/aggregator/Tests/FeedParserTest.php index 71e5b5f..372f084 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Tests/FeedParserTest.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Tests/FeedParserTest.php @@ -92,7 +92,7 @@ function testRedirectFeed() { aggregator_refresh($feed); // Make sure that the feed URL was updated correctly. - $this->assertEqual($feed->url->value, url('aggregator/test-feed', array('absolute' => TRUE))); + $this->assertEqual($feed->getUrl(), url('aggregator/test-feed', array('absolute' => TRUE))); } /** diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Tests/FeedProcessorPluginTest.php b/core/modules/aggregator/lib/Drupal/aggregator/Tests/FeedProcessorPluginTest.php index c880b15..2949150 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Tests/FeedProcessorPluginTest.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Tests/FeedProcessorPluginTest.php @@ -41,7 +41,7 @@ public function testProcess() { $this->updateFeedItems($feed); foreach ($feed->items as $iid) { $item = entity_load('aggregator_item', $iid); - $this->assertTrue(strpos($item->getTitle(), 'testProcessor') === 0); + $this->assertTrue(strpos($item->label(), 'testProcessor') === 0); } } @@ -65,6 +65,6 @@ public function testPostProcess() { // Reload the feed to get new values. $feed = entity_load('aggregator_feed', $feed->id(), TRUE); // Make sure its refresh rate doubled. - $this->assertEqual($feed->refresh->value, 3600); + $this->assertEqual($feed->getRefreshRate(), 3600); } } diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Tests/RemoveFeedTest.php b/core/modules/aggregator/lib/Drupal/aggregator/Tests/RemoveFeedTest.php index d827be8..46f0c5e 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Tests/RemoveFeedTest.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Tests/RemoveFeedTest.php @@ -54,7 +54,7 @@ function testRemoveFeed() { $this->assertResponse(404, 'Deleted feed source does not exists.'); // Check database for feed. - $result = db_query("SELECT COUNT(*) FROM {aggregator_feed} WHERE title = :title AND url = :url", array(':title' => $feed1->label(), ':url' => $feed1->url->value))->fetchField(); + $result = db_query("SELECT COUNT(*) FROM {aggregator_feed} WHERE title = :title AND url = :url", array(':title' => $feed1->label(), ':url' => $feed1->getUrl()))->fetchField(); $this->assertFalse($result, 'Feed not found in database'); }