Issue #2321501 by Temoor, prics: Replace calls to aggregator_feed_load(), entity_load('aggregator_feed') and entity_load_multiple() with static method calls.

8.0.x
Alex Pott 2014-10-04 16:39:10 +02:00
parent 365358c5b0
commit c329dfd418
3 changed files with 10 additions and 4 deletions

View File

@ -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 @@ class FeedProcessorPluginTest extends AggregatorTestBase {
$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 @@ class FeedProcessorPluginTest extends AggregatorTestBase {
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);
}

View File

@ -39,7 +39,7 @@ class MigrateAggregatorFeedTest extends MigrateDrupalTestBase {
*/
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');

View File

@ -59,7 +59,7 @@ class MigrateAggregatorItemTest extends MigrateDrupalTestBase {
*/
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');