3 namespace Drupal\Tests\aggregator\Kernel\Migrate\d7;
5 use Drupal\aggregator\Entity\Item;
6 use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
9 * Tests migration of aggregator items.
11 * @group migrate_drupal_7
13 class MigrateAggregatorItemTest extends MigrateDrupal7TestBase {
18 public static $modules = ['aggregator'];
23 protected function setUp() {
25 $this->installEntitySchema('aggregator_feed');
26 $this->installEntitySchema('aggregator_item');
27 $this->executeMigration('d7_aggregator_feed');
28 $this->executeMigration('d7_aggregator_item');
32 * Test Drupal 7 aggregator item migration to Drupal 8.
34 public function testAggregatorItem() {
35 // Since the feed items can change as the fixture is updated normally,
36 // assert all migrated feed items against the values in the fixture.
37 $items = $this->sourceDatabase
38 ->select('aggregator_item', 'ai')
42 foreach ($items as $original) {
43 /** @var \Drupal\aggregator\ItemInterface $item */
44 $item = Item::load($original->iid);
45 $this->assertIdentical($original->fid, $item->getFeedId());
46 $this->assertIdentical($original->title, $item->label());
47 // If $original->author is an empty string, getAuthor() returns NULL so
48 // we need to use assertEqual() here.
49 $this->assertEqual($original->author, $item->getAuthor());
50 $this->assertIdentical($original->description, $item->getDescription());
51 $this->assertIdentical($original->link, $item->getLink());
52 $this->assertIdentical($original->timestamp, $item->getPostedTime());
53 $this->assertIdentical('en', $item->language()->getId());
54 $this->assertIdentical($original->guid, $item->getGuid());