function MigrateAggregatorItemTest::testAggregatorItem

Same name in this branch
  1. 8.9.x core/modules/aggregator/tests/src/Kernel/Migrate/d6/MigrateAggregatorItemTest.php \Drupal\Tests\aggregator\Kernel\Migrate\d6\MigrateAggregatorItemTest::testAggregatorItem()
Same name and namespace in other branches
  1. 9 core/modules/aggregator/tests/src/Kernel/Migrate/d6/MigrateAggregatorItemTest.php \Drupal\Tests\aggregator\Kernel\Migrate\d6\MigrateAggregatorItemTest::testAggregatorItem()
  2. 9 core/modules/aggregator/tests/src/Kernel/Migrate/d7/MigrateAggregatorItemTest.php \Drupal\Tests\aggregator\Kernel\Migrate\d7\MigrateAggregatorItemTest::testAggregatorItem()

Test Drupal 7 aggregator item migration to Drupal 8.

File

core/modules/aggregator/tests/src/Kernel/Migrate/d7/MigrateAggregatorItemTest.php, line 34

Class

MigrateAggregatorItemTest
Tests migration of aggregator items.

Namespace

Drupal\Tests\aggregator\Kernel\Migrate\d7

Code

public function testAggregatorItem() {
    // Since the feed items can change as the fixture is updated normally,
    // assert all migrated feed items against the values in the fixture.
    $items = $this->sourceDatabase
        ->select('aggregator_item', 'ai')
        ->fields('ai')
        ->execute();
    foreach ($items as $original) {
        
        /** @var \Drupal\aggregator\ItemInterface $item */
        $item = Item::load($original->iid);
        $this->assertIdentical($original->fid, $item->getFeedId());
        $this->assertIdentical($original->title, $item->label());
        // If $original->author is an empty string, getAuthor() returns NULL so
        // we need to use assertEqual() here.
        $this->assertEqual($original->author, $item->getAuthor());
        $this->assertIdentical($original->description, $item->getDescription());
        $this->assertIdentical($original->link, $item->getLink());
        $this->assertIdentical($original->timestamp, $item->getPostedTime());
        $this->assertIdentical('en', $item->language()
            ->getId());
        $this->assertIdentical($original->guid, $item->getGuid());
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.