MigrateAggregatorItemTest.php in Drupal 9
File
core/modules/aggregator/tests/src/Kernel/Migrate/d7/MigrateAggregatorItemTest.php
View source
<?php
namespace Drupal\Tests\aggregator\Kernel\Migrate\d7;
use Drupal\aggregator\Entity\Item;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
class MigrateAggregatorItemTest extends MigrateDrupal7TestBase {
protected static $modules = [
'aggregator',
];
protected function setUp() : void {
parent::setUp();
$this
->installEntitySchema('aggregator_feed');
$this
->installEntitySchema('aggregator_item');
$this
->executeMigration('d7_aggregator_feed');
$this
->executeMigration('d7_aggregator_item');
}
public function testAggregatorItem() {
$items = $this->sourceDatabase
->select('aggregator_item', 'ai')
->fields('ai')
->execute();
foreach ($items as $original) {
$item = Item::load($original->iid);
$this
->assertSame($original->fid, $item
->getFeedId());
$this
->assertSame($original->title, $item
->label());
$this
->assertEquals($original->author, $item
->getAuthor());
$this
->assertSame($original->description, $item
->getDescription());
$this
->assertSame($original->link, $item
->getLink());
$this
->assertSame($original->timestamp, $item
->getPostedTime());
$this
->assertSame('en', $item
->language()
->getId());
$this
->assertSame($original->guid, $item
->getGuid());
}
}
}