Issue #2812625 by quietone: contact_category should dedupe contact_form not user_role

8.3.x
Alex Pott 2016-10-26 12:49:44 -07:00
parent 2b74c93361
commit 8c813b1e5b
2 changed files with 25 additions and 2 deletions

View File

@ -12,8 +12,8 @@ process:
source: category
-
plugin: dedupe_entity
entity_type: user_role
field: cid
entity_type: contact_form
field: id
length: 32
label: category
recipients: recipients

View File

@ -47,6 +47,29 @@ class MigrateContactCategoryTest extends MigrateDrupal6TestBase {
$this->assertIdentical(array('fortyninechars@example.com'), $contact_form->getRecipients());
$this->assertIdentical('', $contact_form->getReply());
$this->assertIdentical(2, $contact_form->getWeight());
// Test there are no duplicated roles.
$contact_forms = [
'website_feedback1',
'some_other_category1',
'a_category_much_longer_than_thir1',
];
$this->assertEmpty(ContactForm::loadMultiple($contact_forms));
/*
* Remove the map row for the Website feedback contact form so that it
* can be migrated again.
*/
$id_map = $this->getMigration('contact_category')->getIdMap();
$id_map->delete(['cid' => '1']);
$this->executeMigration('contact_category');
// Test there is a duplicate Website feedback form.
$contact_form = ContactForm::load('website_feedback1');
$this->assertSame('Website feedback', $contact_form->label());
$this->assertSame(array('admin@example.com'), $contact_form->getRecipients());
$this->assertSame('', $contact_form->getReply());
$this->assertSame(0, $contact_form->getWeight());
}
}