Commit c329dfd4 authored by alexpott's avatar alexpott
Browse files

Issue #2321501 by Temoor, prics: Replace calls to aggregator_feed_load(),...

Issue #2321501 by Temoor, prics: Replace calls to aggregator_feed_load(), entity_load('aggregator_feed') and entity_load_multiple() with static method calls.
parent 365358c5
......@@ -7,6 +7,9 @@
namespace Drupal\aggregator\Tests;
use Drupal\aggregator\Entity\Feed;
use Drupal\aggregator\Entity\Item;
/**
* Tests the processor plugins functionality and discoverability.
*
......@@ -33,7 +36,7 @@ public function testProcess() {
$feed = $this->createFeed();
$this->updateFeedItems($feed);
foreach ($feed->items as $iid) {
$item = entity_load('aggregator_item', $iid);
$item = Item::load($iid);
$this->assertTrue(strpos($item->label(), 'testProcessor') === 0);
}
}
......@@ -55,8 +58,11 @@ public function testDelete() {
public function testPostProcess() {
$feed = $this->createFeed(NULL, array('refresh' => 1800));
$this->updateFeedItems($feed);
$feed_id = $feed->id();
// Reset entity cache manually.
\Drupal::entityManager()->getStorage('aggregator_feed')->resetCache(array($feed_id));
// Reload the feed to get new values.
$feed = entity_load('aggregator_feed', $feed->id(), TRUE);
$feed = Feed::load($feed_id);
// Make sure its refresh rate doubled.
$this->assertEqual($feed->getRefreshRate(), 3600);
}
......
......@@ -39,7 +39,7 @@ protected function setUp() {
*/
public function testAggregatorFeedImport() {
/** @var Feed $feed */
$feed = entity_load('aggregator_feed', 5);
$feed = Feed::load(5);
$this->assertNotNull($feed->uuid());
$this->assertEqual($feed->title->value, 'Know Your Meme');
$this->assertEqual($feed->language()->id, 'en');
......
......@@ -59,7 +59,7 @@ protected function setUp() {
*/
public function testAggregatorItem() {
/** @var Item $item */
$item = entity_load('aggregator_item', 1);
$item = Item::load(1);
$this->assertEqual($item->id(), 1);
$this->assertEqual($item->getFeedId(), 5);
$this->assertEqual($item->label(), 'This (three) weeks in Drupal Core - January 10th 2014');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment