Update to Drupal 8.2.2. For more information, see https://www.drupal.org/project/drupal/releases/8.2.2
This commit is contained in:
parent
23ffed3665
commit
507b45a0ed
378 changed files with 11434 additions and 5542 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\contact\Kernel\Plugin\migrate\source;
|
||||
|
||||
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
|
||||
|
||||
/**
|
||||
* Tests D6 contact category source plugin.
|
||||
*
|
||||
* @covers \Drupal\contact\Plugin\migrate\source\ContactCategory
|
||||
* @group contact
|
||||
*/
|
||||
class ContactCategoryTest extends MigrateSqlSourceTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['contact', 'migrate_drupal', 'user'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function providerSource() {
|
||||
$tests = [
|
||||
[
|
||||
'source_data' => [],
|
||||
'expected_data' => [],
|
||||
],
|
||||
];
|
||||
|
||||
$tests[0]['expected_data'] = [
|
||||
[
|
||||
'cid' => 1,
|
||||
'category' => 'contact category value 1',
|
||||
'recipients' => ['admin@example.com', 'user@example.com'],
|
||||
'reply' => 'auto reply value 1',
|
||||
'weight' => 0,
|
||||
'selected' => 0,
|
||||
],
|
||||
[
|
||||
'cid' => 2,
|
||||
'category' => 'contact category value 2',
|
||||
'recipients' => ['admin@example.com', 'user@example.com'],
|
||||
'reply' => 'auto reply value 2',
|
||||
'weight' => 0,
|
||||
'selected' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($tests[0]['expected_data'] as $k => $row) {
|
||||
$row['recipients'] = implode(',', $row['recipients']);
|
||||
$tests[0]['source_data']['contact'][$k] = $row;
|
||||
}
|
||||
return $tests;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\contact\Kernel\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
|
||||
|
||||
/**
|
||||
* Tests D6 contact settings source plugin.
|
||||
*
|
||||
* @covers \Drupal\contact\Plugin\migrate\source\ContactSettings
|
||||
* @group contact
|
||||
*/
|
||||
class ContactSettingsTest extends MigrateSqlSourceTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['contact', 'migrate_drupal', 'user'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function providerSource() {
|
||||
$tests = [];
|
||||
|
||||
$tests[0]['source_data']['variable'] = [
|
||||
[
|
||||
'name' => 'site_name',
|
||||
'value' => serialize('Blorf!'),
|
||||
],
|
||||
];
|
||||
$tests[0]['source_data']['contact'] = [
|
||||
[
|
||||
'cid' => '1',
|
||||
'category' => 'Website feedback',
|
||||
'recipients' => 'admin@example.com',
|
||||
'reply' => '',
|
||||
'weight' => '0',
|
||||
'selected' => '1',
|
||||
]
|
||||
];
|
||||
$tests[0]['expected_data'] = [
|
||||
[
|
||||
'default_category' => '1',
|
||||
'site_name' => 'Blorf!',
|
||||
],
|
||||
];
|
||||
$tests[0]['expected_count'] = NULL;
|
||||
$tests[0]['configuration']['variables'] = ['site_name'];
|
||||
|
||||
return $tests;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\contact\Unit\Plugin\migrate\source;
|
||||
|
||||
use Drupal\contact\Plugin\migrate\source\ContactCategory;
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
||||
/**
|
||||
* Tests contact_category source plugin.
|
||||
*
|
||||
* @group contact
|
||||
*/
|
||||
class ContactCategoryTest extends MigrateSqlSourceTestCase {
|
||||
|
||||
const PLUGIN_CLASS = ContactCategory::class;
|
||||
|
||||
protected $migrationConfiguration = array(
|
||||
'id' => 'test',
|
||||
'source' => array(
|
||||
'plugin' => 'contact_category',
|
||||
),
|
||||
);
|
||||
|
||||
protected $expectedResults = array(
|
||||
array(
|
||||
'cid' => 1,
|
||||
'category' => 'contact category value 1',
|
||||
'recipients' => array('admin@example.com', 'user@example.com'),
|
||||
'reply' => 'auto reply value 1',
|
||||
'weight' => 0,
|
||||
'selected' => 0,
|
||||
),
|
||||
array(
|
||||
'cid' => 2,
|
||||
'category' => 'contact category value 2',
|
||||
'recipients' => array('admin@example.com', 'user@example.com'),
|
||||
'reply' => 'auto reply value 2',
|
||||
'weight' => 0,
|
||||
'selected' => 0,
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
foreach ($this->expectedResults as $k => $row) {
|
||||
$this->databaseContents['contact'][$k] = $row;
|
||||
$this->databaseContents['contact'][$k]['recipients'] = implode(',', $row['recipients']);
|
||||
}
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\contact\Unit\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\contact\Plugin\migrate\source\ContactSettings;
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
||||
/**
|
||||
* Tests D6 contact settings source plugin.
|
||||
*
|
||||
* @group contact
|
||||
*/
|
||||
class ContactSettingsTest extends MigrateSqlSourceTestCase {
|
||||
|
||||
const PLUGIN_CLASS = ContactSettings::class;
|
||||
|
||||
protected $migrationConfiguration = array(
|
||||
'id' => 'test',
|
||||
'source' => array(
|
||||
'plugin' => 'd6_contact_settings',
|
||||
'variables' => array('site_name'),
|
||||
),
|
||||
);
|
||||
|
||||
protected $expectedResults = array(
|
||||
array(
|
||||
'default_category' => '1',
|
||||
'site_name' => 'Blorf!',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
$this->databaseContents['variable'] = array(
|
||||
array(
|
||||
'name' => 'site_name',
|
||||
'value' => serialize('Blorf!'),
|
||||
),
|
||||
);
|
||||
$this->databaseContents['contact'] = array(
|
||||
array(
|
||||
'cid' => '1',
|
||||
'category' => 'Website feedback',
|
||||
'recipients' => 'admin@example.com',
|
||||
'reply' => '',
|
||||
'weight' => '0',
|
||||
'selected' => '1',
|
||||
)
|
||||
);
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue