Commit ad81d250 authored by webchick's avatar webchick

Issue #2594263 by phenaproxima, neclimdul, Gábor Hojtsy, Kazanir: Add...

Issue #2594263 by phenaproxima, neclimdul, Gábor Hojtsy, Kazanir: Add translation data to Migrate Drupal's test fixtures
parent da7ad2ed
......@@ -13,11 +13,14 @@
/**
* Test migration to aggregator_feed entities.
*
* @group aggregator
* @group migrate_drupal_7
*/
class MigrateAggregatorFeedTest extends MigrateDrupal7TestBase {
public static $modules = array('aggregator');
/**
* {@inheritdoc}
*/
public static $modules = ['aggregator'];
/**
* {@inheritdoc}
......@@ -32,19 +35,25 @@ protected function setUp() {
* Tests migration of aggregator feeds.
*/
public function testAggregatorFeedImport() {
/** @var \Drupal\aggregator\Entity\Feed $feed */
/** @var \Drupal\aggregator\FeedInterface $feed */
$feed = Feed::load(1);
$this->assertIdentical('Know Your Meme', $feed->title->value);
$this->assertIdentical('Know Your Meme', $feed->label());
$this->assertIdentical('en', $feed->language()->getId());
$this->assertIdentical('http://knowyourmeme.com/newsfeed.rss', $feed->url->value);
$this->assertIdentical('900', $feed->refresh->value);
$this->assertIdentical('1387659487', $feed->checked->value);
$this->assertIdentical('0', $feed->queued->value);
$this->assertIdentical('http://knowyourmeme.com/newsfeed.rss', $feed->getUrl());
$this->assertIdentical('900', $feed->getRefreshRate());
// The feed's last checked time can change as the fixture is updated, so
// assert that its format is correct.
$checked_time = $feed->getLastCheckedTime();
$this->assertTrue(is_numeric($checked_time));
$this->assertTrue($checked_time > 1000000000);
$this->assertIdentical('0', $feed->getQueuedTime());
$this->assertIdentical('http://knowyourmeme.com', $feed->link->value);
$this->assertIdentical('New items added to the News Feed', $feed->description->value);
$this->assertIdentical('http://b.thumbs.redditmedia.com/harEHsUUZVajabtC.png', $feed->image->value);
$this->assertIdentical('"213cc1365b96c310e92053c5551f0504"', $feed->etag->value);
$this->assertIdentical('0', $feed->modified->value);
$this->assertIdentical('New items added to the News Feed', $feed->getDescription());
$this->assertNull($feed->getImage());
// As with getLastCheckedTime(), the etag can change as the fixture is
// updated normally, so assert that its format is correct.
$this->assertTrue(preg_match('/^"[a-z0-9]{32}"$/', $feed->getEtag()));
$this->assertIdentical('0', $feed->getLastModified());
}
}
......@@ -13,11 +13,14 @@
/**
* Tests migration of aggregator items.
*
* @group aggregator
* @group migrate_drupal_7
*/
class MigrateAggregatorItemTest extends MigrateDrupal7TestBase {
public static $modules = array('aggregator');
/**
* {@inheritdoc}
*/
public static $modules = ['aggregator'];
/**
* {@inheritdoc}
......@@ -34,17 +37,27 @@ protected function setUp() {
* Test Drupal 7 aggregator item migration to Drupal 8.
*/
public function testAggregatorItem() {
/** @var \Drupal\aggregator\Entity\Item $item */
$item = Item::load(1);
$this->assertIdentical('1', $item->id());
$this->assertIdentical('1', $item->getFeedId());
$this->assertIdentical('This (three) weeks in Drupal Core - January 10th 2014', $item->label());
$this->assertIdentical('larowlan', $item->getAuthor());
$this->assertIdentical("<h2 id='new'>What's new with Drupal 8?</h2>", $item->getDescription());
$this->assertIdentical('https://groups.drupal.org/node/395218', $item->getLink());
$this->assertIdentical('1389297196', $item->getPostedTime());
// 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('395218 at https://groups.drupal.org', $item->getGuid());
$this->assertIdentical($original->guid, $item->getGuid());
}
}
}
......@@ -20,7 +20,18 @@ process:
0: comment_no_subject
bundle: node_type
'default_value/0/status': comment
'settings/default_mode': comment_default_mode
'settings/default_mode':
plugin: static_map
source: comment_default_mode
map:
# COMMENT_MODE_FLAT_COLLAPSED --> COMMENT_MODE_FLAT
1: 0
# COMMENT_MODE_FLAT_EXPANDED --> COMMENT_MODE_FLAT
2: 0
# COMMENT_MODE_THREADED_COLLAPSED --> COMMENT_MODE_THREADED
3: 1
# COMMENT_MODE_THREADED_EXPANDED --> COMMENT_MODE_THREADED
4: 1
'settings/per_page': comment_default_per_page
'settings/anonymous': comment_anonymous
'settings/form_location': comment_form_location
......
......@@ -7,6 +7,7 @@
namespace Drupal\comment\Tests\Migrate\d6;
use Drupal\comment\CommentManagerInterface;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
use Drupal\node\Entity\Node;
......@@ -44,21 +45,21 @@ public function testCommentFieldInstance() {
$this->assertIdentical(0, $node->comment->status);
$this->assertIdentical('comment', $node->comment->getFieldDefinition()->getName());
$settings = $node->comment->getFieldDefinition()->getSettings();
$this->assertIdentical(4, $settings['default_mode']);
$this->assertIdentical(CommentManagerInterface::COMMENT_MODE_THREADED, $settings['default_mode']);
$this->assertIdentical(50, $settings['per_page']);
$this->assertIdentical(0, $settings['anonymous']);
$this->assertIdentical(FALSE, $settings['form_location']);
$this->assertIdentical(1, $settings['preview']);
$this->assertFalse($settings['anonymous']);
$this->assertFalse($settings['form_location']);
$this->assertTrue($settings['preview']);
$node = Node::create(['type' => 'story']);
$this->assertIdentical(2, $node->comment_no_subject->status);
$this->assertIdentical('comment_no_subject', $node->comment_no_subject->getFieldDefinition()->getName());
$settings = $node->comment_no_subject->getFieldDefinition()->getSettings();
$this->assertIdentical(2, $settings['default_mode']);
$this->assertIdentical(CommentManagerInterface::COMMENT_MODE_FLAT, $settings['default_mode']);
$this->assertIdentical(70, $settings['per_page']);
$this->assertIdentical(1, $settings['anonymous']);
$this->assertIdentical(FALSE, $settings['form_location']);
$this->assertIdentical(0, $settings['preview']);
$this->assertTrue($settings['anonymous']);
$this->assertFalse($settings['form_location']);
$this->assertFalse($settings['preview']);
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment