Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542
This commit is contained in:
parent
3b2511d96d
commit
81ccda77eb
2155 changed files with 54307 additions and 46870 deletions
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\taxonomy\Unit\Migrate\d6\TermSourceWithVocabularyFilterTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\taxonomy\Unit\Migrate\d6;
|
||||
|
||||
/**
|
||||
* Tests the Drupal 6 taxonomy term source with vocabulary filter.
|
||||
*
|
||||
* @group taxonomy
|
||||
*/
|
||||
class TermSourceWithVocabularyFilterTest extends TermTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
$this->migrationConfiguration['source']['vocabulary'] = array(5);
|
||||
parent::setUp();
|
||||
$this->expectedResults = array_values(array_filter($this->expectedResults, function($result) {
|
||||
return $result['vid'] == 5;
|
||||
}));
|
||||
// We know there are two rows with vid == 5.
|
||||
$this->expectedCount = 2;
|
||||
}
|
||||
|
||||
}
|
17
core/modules/taxonomy/tests/src/Unit/Migrate/d6/TermTest.php
Normal file
17
core/modules/taxonomy/tests/src/Unit/Migrate/d6/TermTest.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\taxonomy\Unit\Migrate\d6\TermTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\taxonomy\Unit\Migrate\d6;
|
||||
|
||||
/**
|
||||
* Tests D6 taxonomy term source plugin.
|
||||
*
|
||||
* @group taxonomy
|
||||
*/
|
||||
class TermTest extends TermTestBase {
|
||||
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\taxonomy\Unit\Migrate\d6\TermTestBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\taxonomy\Unit\Migrate\d6;
|
||||
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
||||
/**
|
||||
* Base class for taxonomy term source unit tests.
|
||||
*/
|
||||
abstract class TermTestBase extends MigrateSqlSourceTestCase {
|
||||
|
||||
const PLUGIN_CLASS = 'Drupal\taxonomy\Plugin\migrate\source\d6\Term';
|
||||
|
||||
protected $migrationConfiguration = array(
|
||||
'id' => 'test',
|
||||
'highWaterProperty' => array('field' => 'test'),
|
||||
'idlist' => array(),
|
||||
'source' => array(
|
||||
'plugin' => 'd6_taxonomy_term',
|
||||
),
|
||||
);
|
||||
|
||||
protected $expectedResults = array(
|
||||
array(
|
||||
'tid' => 1,
|
||||
'vid' => 5,
|
||||
'name' => 'name value 1',
|
||||
'description' => 'description value 1',
|
||||
'weight' => 0,
|
||||
'parent' => array(0),
|
||||
),
|
||||
array(
|
||||
'tid' => 2,
|
||||
'vid' => 6,
|
||||
'name' => 'name value 2',
|
||||
'description' => 'description value 2',
|
||||
'weight' => 0,
|
||||
'parent' => array(0),
|
||||
),
|
||||
array(
|
||||
'tid' => 3,
|
||||
'vid' => 6,
|
||||
'name' => 'name value 3',
|
||||
'description' => 'description value 3',
|
||||
'weight' => 0,
|
||||
'parent' => array(0),
|
||||
),
|
||||
array(
|
||||
'tid' => 4,
|
||||
'vid' => 5,
|
||||
'name' => 'name value 4',
|
||||
'description' => 'description value 4',
|
||||
'weight' => 1,
|
||||
'parent' => array(1),
|
||||
),
|
||||
array(
|
||||
'tid' => 5,
|
||||
'vid' => 6,
|
||||
'name' => 'name value 5',
|
||||
'description' => 'description value 5',
|
||||
'weight' => 1,
|
||||
'parent' => array(2),
|
||||
),
|
||||
array(
|
||||
'tid' => 6,
|
||||
'vid' => 6,
|
||||
'name' => 'name value 6',
|
||||
'description' => 'description value 6',
|
||||
'weight' => 0,
|
||||
'parent' => array(3, 2),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
foreach ($this->expectedResults as $k => $row) {
|
||||
foreach ($row['parent'] as $parent) {
|
||||
$this->databaseContents['term_hierarchy'][] = array(
|
||||
'tid' => $row['tid'],
|
||||
'parent' => $parent,
|
||||
);
|
||||
}
|
||||
unset($row['parent']);
|
||||
$this->databaseContents['term_data'][$k] = $row;
|
||||
}
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\taxonomy\Unit\Migrate\d6\VocabularyTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\taxonomy\Unit\Migrate\d6;
|
||||
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
||||
/**
|
||||
* Tests D6 vocabulary source plugin.
|
||||
*
|
||||
* @group taxonomy
|
||||
*/
|
||||
class VocabularyTest extends MigrateSqlSourceTestCase {
|
||||
|
||||
const PLUGIN_CLASS = 'Drupal\taxonomy\Plugin\migrate\source\d6\Vocabulary';
|
||||
|
||||
// The fake Migration configuration entity.
|
||||
protected $migrationConfiguration = [
|
||||
// The ID of the entity, can be any string.
|
||||
'id' => 'test',
|
||||
// Leave it empty for now.
|
||||
'idlist' => [],
|
||||
'source' => [
|
||||
'plugin' => 'd6_vocabulary',
|
||||
],
|
||||
];
|
||||
|
||||
protected $expectedResults = [
|
||||
[
|
||||
'vid' => 1,
|
||||
'name' => 'Tags',
|
||||
'description' => 'Tags description.',
|
||||
'help' => 1,
|
||||
'relations' => 0,
|
||||
'hierarchy' => 0,
|
||||
'multiple' => 0,
|
||||
'required' => 0,
|
||||
'tags' => 1,
|
||||
'module' => 'taxonomy',
|
||||
'weight' => 0,
|
||||
'node_types' => ['page', 'article'],
|
||||
],
|
||||
[
|
||||
'vid' => 2,
|
||||
'name' => 'Categories',
|
||||
'description' => 'Categories description.',
|
||||
'help' => 1,
|
||||
'relations' => 1,
|
||||
'hierarchy' => 1,
|
||||
'multiple' => 0,
|
||||
'required' => 1,
|
||||
'tags' => 0,
|
||||
'module' => 'taxonomy',
|
||||
'weight' => 0,
|
||||
'node_types' => ['article'],
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
foreach ($this->expectedResults as &$row) {
|
||||
foreach ($row['node_types'] as $type) {
|
||||
$this->databaseContents['vocabulary_node_types'][] = [
|
||||
'type' => $type,
|
||||
'vid' => $row['vid'],
|
||||
];
|
||||
}
|
||||
unset($row['node_types']);
|
||||
}
|
||||
$this->databaseContents['vocabulary'] = $this->expectedResults;
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue