3 namespace Drupal\Tests\aggregator\Kernel\Migrate\d7;
5 use Drupal\aggregator\Entity\Feed;
6 use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
9 * Test migration to aggregator_feed entities.
11 * @group migrate_drupal_7
13 class MigrateAggregatorFeedTest extends MigrateDrupal7TestBase {
18 public static $modules = ['aggregator'];
23 protected function setUp() {
25 $this->installEntitySchema('aggregator_feed');
26 $this->executeMigration('d7_aggregator_feed');
30 * Tests migration of aggregator feeds.
32 public function testAggregatorFeedImport() {
33 /** @var \Drupal\aggregator\FeedInterface $feed */
34 $feed = Feed::load(1);
35 $this->assertIdentical('Know Your Meme', $feed->label());
36 $this->assertIdentical('en', $feed->language()->getId());
37 $this->assertIdentical('http://knowyourmeme.com/newsfeed.rss', $feed->getUrl());
38 $this->assertIdentical('900', $feed->getRefreshRate());
39 // The feed's last checked time can change as the fixture is updated, so
40 // assert that its format is correct.
41 $checked_time = $feed->getLastCheckedTime();
42 $this->assertTrue(is_numeric($checked_time));
43 $this->assertTrue($checked_time > 1000000000);
44 $this->assertIdentical('0', $feed->getQueuedTime());
45 $this->assertIdentical('http://knowyourmeme.com', $feed->link->value);
46 $this->assertIdentical('New items added to the News Feed', $feed->getDescription());
47 $this->assertNull($feed->getImage());
48 // As with getLastCheckedTime(), the etag can change as the fixture is
49 // updated normally, so assert that its format is correct.
50 $this->assertTrue(preg_match('/^"[a-z0-9]{32}"$/', $feed->getEtag()));
51 $this->assertIdentical('0', $feed->getLastModified());