Issue #2862791 by mitrpaka, Jo Fitzgerald, RajeevK, quietone, harings_rob: LanguageContentSettings source plugin needs tests
parent
43af0f4538
commit
ef519ee578
|
|
@ -0,0 +1,74 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\Tests\language\Kernel\Plugin\migrate\source\d6;
|
||||||
|
|
||||||
|
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests menu source plugin.
|
||||||
|
*
|
||||||
|
* @covers \Drupal\language\Plugin\migrate\source\d6\LanguageContentSettings
|
||||||
|
*
|
||||||
|
* @group language
|
||||||
|
*/
|
||||||
|
class LanguageContentSettingsTest extends MigrateSqlSourceTestBase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public static $modules = ['language', 'migrate_drupal'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function providerSource() {
|
||||||
|
$tests = [];
|
||||||
|
|
||||||
|
// The source data.
|
||||||
|
$tests[0]['source_data']['node_type'] = [
|
||||||
|
[
|
||||||
|
'type' => 'article',
|
||||||
|
'name' => 'Article',
|
||||||
|
'module' => 'node',
|
||||||
|
'description' => 'An <em>article</em>, content type.',
|
||||||
|
'help' => '',
|
||||||
|
'has_title' => 1,
|
||||||
|
'title_label' => 'Title',
|
||||||
|
'has_body' => 1,
|
||||||
|
'body_label' => 'Body',
|
||||||
|
'min_word_count' => 0,
|
||||||
|
'custom' => 1,
|
||||||
|
'modified' => 1,
|
||||||
|
'locked' => 0,
|
||||||
|
'orig_type' => 'story',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'type' => 'company',
|
||||||
|
'name' => 'Company',
|
||||||
|
'module' => 'node',
|
||||||
|
'description' => 'Company node type',
|
||||||
|
'help' => '',
|
||||||
|
'has_title' => 1,
|
||||||
|
'title_label' => 'Name',
|
||||||
|
'has_body' => 1,
|
||||||
|
'body_label' => 'Description',
|
||||||
|
'min_word_count' => 0,
|
||||||
|
'custom' => 0,
|
||||||
|
'modified' => 1,
|
||||||
|
'locked' => 0,
|
||||||
|
'orig_type' => 'company',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($tests[0]['source_data']['node_type'] as $node_type) {
|
||||||
|
$tests[0]['expected_data'][] = [
|
||||||
|
'type' => $node_type['type'],
|
||||||
|
'language_content_type' => NULL,
|
||||||
|
'i18n_lock_node' => 0,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tests;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\Tests\language\Kernel\Plugin\migrate\source\d7;
|
||||||
|
|
||||||
|
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests menu source plugin.
|
||||||
|
*
|
||||||
|
* @covers \Drupal\language\Plugin\migrate\source\d7\LanguageContentSettings
|
||||||
|
*
|
||||||
|
* @group language
|
||||||
|
*/
|
||||||
|
class LanguageContentSettingsTest extends MigrateSqlSourceTestBase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public static $modules = ['language', 'migrate_drupal'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function providerSource() {
|
||||||
|
$tests = [];
|
||||||
|
|
||||||
|
// The source data.
|
||||||
|
$tests[0]['source_data']['node_type'] = [
|
||||||
|
[
|
||||||
|
'type' => 'article',
|
||||||
|
'name' => 'Article',
|
||||||
|
'base' => 'node_content',
|
||||||
|
'module' => 'node',
|
||||||
|
'description' => 'Use <em>articles</em> for time-sensitive content like news, press releases or blog posts.',
|
||||||
|
'help' => 'Help text for articles',
|
||||||
|
'has_title' => 1,
|
||||||
|
'title_label' => 'Title',
|
||||||
|
'custom' => 1,
|
||||||
|
'modified' => 1,
|
||||||
|
'locked' => 0,
|
||||||
|
'disabled' => 0,
|
||||||
|
'orig_type' => 'article',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'type' => 'blog',
|
||||||
|
'name' => 'Blog entry',
|
||||||
|
'base' => 'blog',
|
||||||
|
'module' => 'blog',
|
||||||
|
'description' => 'Use for multi-user blogs. Every user gets a personal blog.',
|
||||||
|
'help' => 'Blog away, good sir!',
|
||||||
|
'has_title' => 1,
|
||||||
|
'title_label' => 'Title',
|
||||||
|
'custom' => 0,
|
||||||
|
'modified' => 1,
|
||||||
|
'locked' => 1,
|
||||||
|
'disabled' => 0,
|
||||||
|
'orig_type' => 'blog',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($tests[0]['source_data']['node_type'] as $node_type) {
|
||||||
|
$tests[0]['expected_data'][] = [
|
||||||
|
'type' => $node_type['type'],
|
||||||
|
'language_content_type' => NULL,
|
||||||
|
'i18n_lock_node' => 0,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tests;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue