MigrateAggregatorFeedTest.php 1.74 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
<?php

/**
 * @file
 * Contains \Drupal\migrate_drupal\Tests\d6\MigrateAggregatorFeedTest.
 */

namespace Drupal\migrate_drupal\Tests\d6;

use Drupal\aggregator\Entity\Feed;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;

14
/**
15 16 17
 * Upgrade variables to aggregator_feed entities.
 *
 * @group migrate_drupal
18
 */
19 20 21 22 23 24 25
class MigrateAggregatorFeedTest extends MigrateDrupalTestBase {

  static $modules = array('aggregator');

  /**
   * {@inheritdoc}
   */
26
  protected function setUp() {
27 28 29
    parent::setUp();
    $migration = entity_load('migration', 'd6_aggregator_feed');
    $dumps = array(
30
      $this->getDumpDirectory() . '/AggregatorFeed.php',
31 32 33 34 35 36 37 38 39 40 41
    );
    $this->prepare($migration, $dumps);
    $executable = new MigrateExecutable($migration, $this);
    $executable->import();
  }

  /**
   * Tests migration of aggregator feeds.
   */
  public function testAggregatorFeedImport() {
    /** @var Feed $feed */
42
    $feed = Feed::load(5);
43 44
    $this->assertNotNull($feed->uuid());
    $this->assertEqual($feed->title->value, 'Know Your Meme');
45
    $this->assertEqual($feed->language()->getId(), 'en');
46 47 48 49 50 51 52 53 54 55 56
    $this->assertEqual($feed->url->value, 'http://knowyourmeme.com/newsfeed.rss');
    $this->assertEqual($feed->refresh->value, 900);
    $this->assertEqual($feed->checked->value, 1387659487);
    $this->assertEqual($feed->queued->value, 0);
    $this->assertEqual($feed->link->value, 'http://knowyourmeme.com');
    $this->assertEqual($feed->description->value, 'New items added to the News Feed');
    $this->assertEqual($feed->image->value, 'http://b.thumbs.redditmedia.com/harEHsUUZVajabtC.png');
    $this->assertEqual($feed->etag->value, '"213cc1365b96c310e92053c5551f0504"');
    $this->assertEqual($feed->modified->value, 0);
  }
}