Pull merge.
[yaffs-website] / web / core / modules / aggregator / tests / src / Kernel / Migrate / d7 / MigrateAggregatorFeedTest.php
1 <?php
2
3 namespace Drupal\Tests\aggregator\Kernel\Migrate\d7;
4
5 use Drupal\aggregator\Entity\Feed;
6 use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
7
8 /**
9  * Test migration to aggregator_feed entities.
10  *
11  * @group migrate_drupal_7
12  */
13 class MigrateAggregatorFeedTest extends MigrateDrupal7TestBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   public static $modules = ['aggregator'];
19
20   /**
21    * {@inheritdoc}
22    */
23   protected function setUp() {
24     parent::setUp();
25     $this->installEntitySchema('aggregator_feed');
26     $this->executeMigration('d7_aggregator_feed');
27   }
28
29   /**
30    * Tests migration of aggregator feeds.
31    */
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());
52   }
53
54 }