#71: Remove files no longer part of Drupal core in Drupal 8.0.0-beta15.
This commit is contained in:
parent
f3791f1da3
commit
1ebe18adc2
101 changed files with 0 additions and 9459 deletions
|
@ -1,78 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\migrate_drupal\Unit\MigrationStorageTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Unit;
|
||||
|
||||
use Drupal\Tests\migrate\Unit\MigrateTestCase;
|
||||
|
||||
/**
|
||||
* Tests the MigrationStorage load plugin.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrationStorageTest extends MigrateTestCase {
|
||||
|
||||
protected $migrationConfiguration = array('id' => 'test_migration', 'migrationClass' => 'Drupal\migrate_drupal\Entity\Migration');
|
||||
|
||||
/**
|
||||
* Test that the entity load hooks are called on dynamic migrations.
|
||||
*
|
||||
* @dataProvider entityIdsDataProvider
|
||||
*/
|
||||
public function testMigrationStorage($entity_ids) {
|
||||
$entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
|
||||
$entity_type
|
||||
->expects($this->exactly(2))
|
||||
->method('isStaticallyCacheable')
|
||||
->willReturn(FALSE);
|
||||
|
||||
$load_plugin = $this->getMock('Drupal\migrate_drupal\Plugin\MigrateLoadInterface');
|
||||
$load_plugin
|
||||
->expects($this->once())
|
||||
->method('loadMultiple')
|
||||
->willReturn([]);
|
||||
|
||||
$migration = $this->getMigration();
|
||||
$migration
|
||||
->expects($this->once())
|
||||
->method('getLoadPlugin')
|
||||
->willReturn($load_plugin);
|
||||
|
||||
$storage = $this->getMock('Drupal\migrate_drupal\TestMigrationStorage', ['postLoad', 'doLoadMultiple'], [$entity_type]);
|
||||
$storage
|
||||
->expects($this->exactly(2))
|
||||
->method('postLoad');
|
||||
$storage
|
||||
->expects($this->once())
|
||||
->method('doLoadMultiple')
|
||||
->willReturn(['test_migration' => $migration]);
|
||||
|
||||
$storage->loadMultiple($entity_ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* The data provider for migration storage.
|
||||
*
|
||||
* @return array
|
||||
* The entity ids.
|
||||
*/
|
||||
public function entityIdsDataProvider() {
|
||||
return [
|
||||
[['test_migration:bundle']],
|
||||
[NULL],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace Drupal\migrate_drupal;
|
||||
|
||||
class TestMigrationStorage extends MigrationStorage {
|
||||
public function __construct($entity_type) {
|
||||
$this->entityType = $entity_type;
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\migrate_drupal\Unit\source\d6\CommentSourceWithHighWaterTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
|
||||
|
||||
/**
|
||||
* Tests the Drupal 6 comment source w/ high water handling.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class CommentSourceWithHighWaterTest extends CommentTestBase {
|
||||
|
||||
const ORIGINAL_HIGH_WATER = 1382255613;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
$this->migrationConfiguration['highWaterProperty']['field'] = 'timestamp';
|
||||
array_shift($this->expectedResults);
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\migrate_drupal\Unit\source\d6\CommentTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
|
||||
|
||||
/**
|
||||
* Tests D6 comment source plugin.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class CommentTest extends CommentTestBase {
|
||||
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\migrate_drupal\Unit\source\d6\CommentTestBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
|
||||
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
||||
/**
|
||||
* Base class for comment source unit tests.
|
||||
*/
|
||||
abstract class CommentTestBase extends MigrateSqlSourceTestCase {
|
||||
|
||||
// The plugin system is not working during unit testing so the source plugin
|
||||
// class needs to be manually specified.
|
||||
const PLUGIN_CLASS = 'Drupal\migrate_drupal\Plugin\migrate\source\d6\Comment';
|
||||
|
||||
// The fake Migration configuration entity.
|
||||
protected $migrationConfiguration = array(
|
||||
// The ID of the entity, can be any string.
|
||||
'id' => 'test',
|
||||
// Leave it empty for now.
|
||||
'idlist' => array(),
|
||||
// This needs to be the identifier of the actual key: cid for comment, nid
|
||||
// for node and so on.
|
||||
'source' => array(
|
||||
'plugin' => 'd6_comment',
|
||||
),
|
||||
);
|
||||
|
||||
// We need to set up the database contents; it's easier to do that below.
|
||||
|
||||
protected $expectedResults = array(
|
||||
array(
|
||||
'cid' => 1,
|
||||
'pid' => 0,
|
||||
'nid' => 2,
|
||||
'uid' => 3,
|
||||
'subject' => 'subject value 1',
|
||||
'comment' => 'comment value 1',
|
||||
'hostname' => 'hostname value 1',
|
||||
'timestamp' => 1382255613,
|
||||
'status' => 1,
|
||||
'thread' => '',
|
||||
'name' => '',
|
||||
'mail' => '',
|
||||
'homepage' => '',
|
||||
'format' => 'testformat1',
|
||||
'type' => 'story',
|
||||
),
|
||||
array(
|
||||
'cid' => 2,
|
||||
'pid' => 1,
|
||||
'nid' => 3,
|
||||
'uid' => 4,
|
||||
'subject' => 'subject value 2',
|
||||
'comment' => 'comment value 2',
|
||||
'hostname' => 'hostname value 2',
|
||||
'timestamp' => 1382255662,
|
||||
'status' => 1,
|
||||
'thread' => '',
|
||||
'name' => '',
|
||||
'mail' => '',
|
||||
'homepage' => '',
|
||||
'format' => 'testformat2',
|
||||
'type' => 'page',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
foreach ($this->expectedResults as $k => $row) {
|
||||
$this->databaseContents['comments'][$k] = $row;
|
||||
$this->databaseContents['comments'][$k]['status'] = 1 - $this->databaseContents['comments'][$k]['status'];
|
||||
}
|
||||
// Add node table data.
|
||||
$this->databaseContents['node'][] = array('nid' => 2, 'type' => 'story');
|
||||
$this->databaseContents['node'][] = array('nid' => 3, 'type' => 'page');
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\migrate_drupal\Unit\source\d6\FieldInstancePerViewModeTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
|
||||
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
||||
/**
|
||||
* Tests D6 fields per view mode source plugin.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class FieldInstancePerViewModeTest extends MigrateSqlSourceTestCase {
|
||||
|
||||
// The plugin system is not working during unit testing so the source plugin
|
||||
// class needs to be manually specified.
|
||||
const PLUGIN_CLASS = 'Drupal\migrate_drupal\Plugin\migrate\source\d6\FieldInstancePerViewMode';
|
||||
|
||||
// The fake Migration configuration entity.
|
||||
protected $migrationConfiguration = array(
|
||||
// The ID of the entity, can be any string.
|
||||
'id' => 'view_mode_test',
|
||||
// Leave it empty for now.
|
||||
'idlist' => array(),
|
||||
'source' => array(
|
||||
'plugin' => 'd6_field_instance_per_view_mode',
|
||||
),
|
||||
);
|
||||
|
||||
protected $expectedResults = array(
|
||||
array(
|
||||
'entity_type' => 'node',
|
||||
'view_mode' => 4,
|
||||
'type_name' => 'article',
|
||||
'field_name' => 'field_test',
|
||||
'type' => 'text',
|
||||
'module' => 'text',
|
||||
'weight' => 1,
|
||||
'label' => 'above',
|
||||
'display_settings' => array(
|
||||
'weight' => 1,
|
||||
'parent' => '',
|
||||
'label' => array(
|
||||
'format' => 'above',
|
||||
),
|
||||
4 => array(
|
||||
'format' => 'trimmed',
|
||||
'exclude' => 0,
|
||||
),
|
||||
),
|
||||
'widget_settings' => array(),
|
||||
),
|
||||
array(
|
||||
'entity_type' => 'node',
|
||||
'view_mode' => 'teaser',
|
||||
'type_name' => 'story',
|
||||
'field_name' => 'field_test',
|
||||
'type' => 'text',
|
||||
'module' => 'text',
|
||||
'weight' => 2,
|
||||
'label' => 'above',
|
||||
'display_settings' => array(
|
||||
'weight' => 1,
|
||||
'parent' => '',
|
||||
'label' => array(
|
||||
'format' => 'above',
|
||||
),
|
||||
'teaser' => array(
|
||||
'format' => 'trimmed',
|
||||
'exclude' => 0,
|
||||
),
|
||||
),
|
||||
'widget_settings' => array(),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
foreach ($this->expectedResults as $k => $field_view_mode) {
|
||||
// These are stored as serialized strings.
|
||||
$field_view_mode['display_settings'] = serialize($field_view_mode['display_settings']);
|
||||
$field_view_mode['widget_settings'] = serialize($field_view_mode['widget_settings']);
|
||||
|
||||
$this->databaseContents['content_node_field'][] = array(
|
||||
'field_name' => $field_view_mode['field_name'],
|
||||
'type' => $field_view_mode['type'],
|
||||
'module' => $field_view_mode['module'],
|
||||
);
|
||||
unset($field_view_mode['type']);
|
||||
unset($field_view_mode['module']);
|
||||
|
||||
$this->databaseContents['content_node_field_instance'][] = $field_view_mode;
|
||||
|
||||
// Update the expected display settings.
|
||||
$this->expectedResults[$k]['display_settings'] = $this->expectedResults[$k]['display_settings'][$field_view_mode['view_mode']];
|
||||
|
||||
}
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\migrate_drupal\Unit\source\d6\FieldInstanceTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
|
||||
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
||||
/**
|
||||
* Tests D6 field instance source plugin.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class FieldInstanceTest extends MigrateSqlSourceTestCase {
|
||||
|
||||
// The plugin system is not working during unit testing so the source plugin
|
||||
// class needs to be manually specified.
|
||||
const PLUGIN_CLASS = 'Drupal\migrate_drupal\Plugin\migrate\source\d6\FieldInstance';
|
||||
|
||||
// The fake Migration configuration entity.
|
||||
protected $migrationConfiguration = [
|
||||
// The id of the entity, can be any string.
|
||||
'id' => 'test_fieldinstance',
|
||||
// Leave it empty for now.
|
||||
'idlist' => [],
|
||||
'source' => [
|
||||
'plugin' => 'd6_field_instance',
|
||||
],
|
||||
];
|
||||
|
||||
// We need to set up the database contents; it's easier to do that below.
|
||||
// These are sample result queries.
|
||||
protected $expectedResults = [
|
||||
[
|
||||
'field_name' => 'field_body',
|
||||
'type_name' => 'page',
|
||||
'weight' => 1,
|
||||
'label' => 'body',
|
||||
'widget_type' => 'text_textarea',
|
||||
'widget_settings' => '',
|
||||
'display_settings' => '',
|
||||
'description' => '',
|
||||
'widget_module' => 'text',
|
||||
'widget_active' => 1,
|
||||
'required' => 1,
|
||||
'active' => 1,
|
||||
'global_settings' => [],
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Prepopulate contents with results.
|
||||
*/
|
||||
protected function setUp() {
|
||||
$this->expectedResults[0]['widget_settings'] = [
|
||||
'rows' => 5,
|
||||
'size' => 60,
|
||||
'default_value' => [
|
||||
[
|
||||
'value' => '',
|
||||
'_error_element' => 'default_value_widget][field_body][0][value',
|
||||
'default_value_php' => '',
|
||||
],
|
||||
],
|
||||
];
|
||||
$this->expectedResults[0]['display_settings'] = [
|
||||
'label' => [
|
||||
'format' => 'above',
|
||||
'exclude' => 0,
|
||||
],
|
||||
'teaser' => [
|
||||
'format' => 'default',
|
||||
'exclude' => 0,
|
||||
],
|
||||
'full' => [
|
||||
'format' => 'default',
|
||||
'exclude' => 0,
|
||||
],
|
||||
];
|
||||
$this->databaseContents['content_node_field_instance'] = $this->expectedResults;
|
||||
$this->databaseContents['content_node_field_instance'][0]['widget_settings'] = serialize($this->expectedResults[0]['widget_settings']);
|
||||
$this->databaseContents['content_node_field_instance'][0]['display_settings'] = serialize($this->expectedResults[0]['display_settings']);
|
||||
$this->databaseContents['content_node_field_instance'][0]['global_settings'] = 'a:0:{}';
|
||||
|
||||
$this->databaseContents['content_node_field'][0] = [
|
||||
'field_name' => 'field_body',
|
||||
'required' => 1,
|
||||
'type' => 'text',
|
||||
'active' => 1,
|
||||
'global_settings' => serialize([]),
|
||||
];
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\migrate_drupal\Unit\source\d6\FieldTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
|
||||
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
||||
/**
|
||||
* Tests D6 field source plugin.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class FieldTest extends MigrateSqlSourceTestCase {
|
||||
|
||||
// The plugin system is not working during unit testing so the source plugin
|
||||
// class needs to be manually specified.
|
||||
const PLUGIN_CLASS = 'Drupal\migrate_drupal\Plugin\migrate\source\d6\Field';
|
||||
|
||||
// The fake Migration configuration entity.
|
||||
protected $migrationConfiguration = array(
|
||||
// The id of the entity, can be any string.
|
||||
'id' => 'test_field',
|
||||
// Leave it empty for now.
|
||||
'idlist' => array(),
|
||||
'source' => array(
|
||||
'plugin' => 'd6_field',
|
||||
),
|
||||
);
|
||||
|
||||
// We need to set up the database contents; it's easier to do that below.
|
||||
// These are sample result queries.
|
||||
protected $expectedResults = array(
|
||||
array(
|
||||
'field_name' => 'field_body',
|
||||
'type' => 'text',
|
||||
'global_settings' => '',
|
||||
'required' => 0,
|
||||
'multiple' => 0,
|
||||
'db_storage' => 1,
|
||||
'module' => 'text',
|
||||
'db_columns' => '',
|
||||
'active' => 1,
|
||||
'locked' => 0,
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Prepopulate contents with results.
|
||||
*/
|
||||
protected function setUp() {
|
||||
$this->expectedResults[0]['global_settings'] = array(
|
||||
'text_processing' => 0,
|
||||
'max_length' => '',
|
||||
'allowed_values' => '',
|
||||
'allowed_values_php' => '',
|
||||
);
|
||||
$this->expectedResults[0]['db_columns'] = array(
|
||||
'value' => array(
|
||||
'type' => 'text',
|
||||
'size' => 'big',
|
||||
'not null' => '',
|
||||
'sortable' => 1,
|
||||
'views' => 1,
|
||||
),
|
||||
);
|
||||
$this->databaseContents['content_node_field'] = $this->expectedResults;
|
||||
$this->databaseContents['content_node_field'][0]['global_settings'] = serialize($this->databaseContents['content_node_field'][0]['global_settings']);
|
||||
$this->databaseContents['content_node_field'][0]['db_columns'] = serialize($this->databaseContents['content_node_field'][0]['db_columns']);
|
||||
|
||||
$this->databaseContents['content_node_field_instance'][0]['widget_settings'] = serialize(array());
|
||||
$this->databaseContents['content_node_field_instance'][0]['widget_type'] = 'text_textarea';
|
||||
$this->databaseContents['content_node_field_instance'][0]['field_name'] = 'field_body';
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\migrate_drupal\Unit\source\d6\FileTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
|
||||
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
||||
/**
|
||||
* Tests D6 file source plugin.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class FileTest extends MigrateSqlSourceTestCase {
|
||||
|
||||
const PLUGIN_CLASS = 'Drupal\migrate_drupal\Plugin\migrate\source\d6\File';
|
||||
|
||||
// The fake Migration configuration entity.
|
||||
protected $migrationConfiguration = array(
|
||||
// The ID of the entity, can be any string.
|
||||
'id' => 'test',
|
||||
// Leave it empty for now.
|
||||
'idlist' => array(),
|
||||
'source' => array(
|
||||
'plugin' => 'd6_file',
|
||||
),
|
||||
);
|
||||
|
||||
protected $expectedResults = array(
|
||||
array(
|
||||
'fid' => 1,
|
||||
'uid' => 1,
|
||||
'filename' => 'migrate-test-file-1.pdf',
|
||||
'filepath' => 'sites/default/files/migrate-test-file-1.pdf',
|
||||
'filemime' => 'application/pdf',
|
||||
'filesize' => 890404,
|
||||
'status' => 1,
|
||||
'timestamp' => 1382255613,
|
||||
),
|
||||
array(
|
||||
'fid' => 2,
|
||||
'uid' => 1,
|
||||
'filename' => 'migrate-test-file-2.pdf',
|
||||
'filepath' => 'sites/default/files/migrate-test-file-2.pdf',
|
||||
'filemime' => 'application/pdf',
|
||||
'filesize' => 204124,
|
||||
'status' => 1,
|
||||
'timestamp' => 1382255662,
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
$this->databaseContents['files'] = $this->expectedResults;
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\migrate_drupal\Unit\source\d6\ProfileFieldTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
|
||||
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
||||
/**
|
||||
* Tests D6 profile field source plugin.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class ProfileFieldTest extends MigrateSqlSourceTestCase {
|
||||
|
||||
// The plugin system is not working during unit testing so the source plugin
|
||||
// class needs to be manually specified.
|
||||
const PLUGIN_CLASS = 'Drupal\migrate_drupal\Plugin\migrate\source\d6\ProfileField';
|
||||
|
||||
// The fake Migration configuration entity.
|
||||
protected $migrationConfiguration = [
|
||||
// The id of the entity, can be any string.
|
||||
'id' => 'test_profile_fields',
|
||||
// Leave it empty for now.
|
||||
'idlist' => [],
|
||||
'source' => [
|
||||
'plugin' => 'd6_profile_field',
|
||||
],
|
||||
];
|
||||
|
||||
// We need to set up the database contents; it's easier to do that below.
|
||||
// These are sample result queries.
|
||||
// @todo Add multiple cases.
|
||||
protected $expectedResults = [
|
||||
[
|
||||
'fid' => 1,
|
||||
'title' => 'First name',
|
||||
'name' => 'profile_first_name',
|
||||
'explanation' => 'First name user',
|
||||
'category' => 'profile',
|
||||
'page' => '',
|
||||
'type' => 'textfield',
|
||||
'weight' => 0,
|
||||
'required' => 1,
|
||||
'register' => 0,
|
||||
'visibility' => 2,
|
||||
'autocomplete' => 0,
|
||||
'options' => [],
|
||||
],
|
||||
[
|
||||
'fid' => 2,
|
||||
'title' => 'Last name',
|
||||
'name' => 'profile_last_name',
|
||||
'explanation' => 'Last name user',
|
||||
'category' => 'profile',
|
||||
'page' => '',
|
||||
'type' => 'textfield',
|
||||
'weight' => 0,
|
||||
'required' => 0,
|
||||
'register' => 0,
|
||||
'visibility' => 2,
|
||||
'autocomplete' => 0,
|
||||
'options' => [],
|
||||
],
|
||||
[
|
||||
'fid' => 3,
|
||||
'title' => 'Policy',
|
||||
'name' => 'profile_policy',
|
||||
'explanation' => 'A checkbox that say if you accept policy of website',
|
||||
'category' => 'profile',
|
||||
'page' => '',
|
||||
'type' => 'checkbox',
|
||||
'weight' => 0,
|
||||
'required' => 1,
|
||||
'register' => 1,
|
||||
'visibility' => 2,
|
||||
'autocomplete' => 0,
|
||||
'options' => [],
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Prepopulate contents with results.
|
||||
*/
|
||||
protected function setUp() {
|
||||
$this->databaseContents['profile_fields'] = $this->expectedResults;
|
||||
foreach ($this->databaseContents['profile_fields'] as &$row) {
|
||||
$row['options'] = serialize([]);
|
||||
}
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\migrate_drupal\Unit\source\d6\RoleTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
|
||||
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
||||
/**
|
||||
* Tests D6 role source plugin.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class RoleTest extends MigrateSqlSourceTestCase {
|
||||
|
||||
// The plugin system is not working during unit testing so the source plugin
|
||||
// class needs to be manually specified.
|
||||
const PLUGIN_CLASS = 'Drupal\migrate_drupal\Plugin\migrate\source\d6\Role';
|
||||
|
||||
// The fake Migration configuration entity.
|
||||
protected $migrationConfiguration = array(
|
||||
// The ID of the entity, can be any string.
|
||||
'id' => 'test',
|
||||
// Leave it empty for now.
|
||||
'idlist' => array(),
|
||||
// This needs to be the identifier of the actual key: cid for comment, nid
|
||||
// for node and so on.
|
||||
'source' => array(
|
||||
'plugin' => 'd6_user_role',
|
||||
),
|
||||
);
|
||||
|
||||
protected $expectedResults = array(
|
||||
array(
|
||||
'rid' => 1,
|
||||
'name' => 'anonymous user',
|
||||
'permissions' => array(
|
||||
'access content',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'rid' => 2,
|
||||
'name' => 'authenticated user',
|
||||
'permissions' => array(
|
||||
'access comments',
|
||||
'access content',
|
||||
'post comments',
|
||||
'post comments without approval',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'rid' => 3,
|
||||
'name' => 'administrator',
|
||||
'permissions' => array(
|
||||
'access comments',
|
||||
'administer comments',
|
||||
'post comments',
|
||||
'post comments without approval',
|
||||
'access content',
|
||||
'administer content types',
|
||||
'administer nodes',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
foreach ($this->expectedResults as $row) {
|
||||
$this->databaseContents['permission'][] = array(
|
||||
'perm' => implode(', ', $row['permissions']),
|
||||
'rid' => $row['rid'],
|
||||
);
|
||||
unset($row['permissions']);
|
||||
$this->databaseContents['role'][] = $row;
|
||||
}
|
||||
$this->databaseContents['filter_formats'][] = array(
|
||||
'format' => 1,
|
||||
'roles' => '',
|
||||
);
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\migrate_drupal\Unit\source\d6\TestComment.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
|
||||
|
||||
use Drupal\Core\Database\Connection;
|
||||
use Drupal\Core\Extension\ModuleHandlerInterface;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\d6\Comment;
|
||||
|
||||
class TestComment extends Comment {
|
||||
public function setDatabase(Connection $database) {
|
||||
$this->database = $database;
|
||||
}
|
||||
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
|
||||
$this->moduleHandler = $module_handler;
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\migrate_drupal\Unit\source\d6\TestNode.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
|
||||
|
||||
use Drupal\Core\Database\Connection;
|
||||
use Drupal\Core\Extension\ModuleHandlerInterface;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\d6\Node;
|
||||
|
||||
/**
|
||||
* Provides a node source plugin used for unit testing.
|
||||
*/
|
||||
class TestNode extends Node {
|
||||
|
||||
/**
|
||||
* Sets the database connection for this source plugin.
|
||||
*
|
||||
* @param \Drupal\Core\Database\Connection $database
|
||||
*/
|
||||
public function setDatabase(Connection $database) {
|
||||
$this->database = $database;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the module handler for this source plugin.
|
||||
*
|
||||
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
|
||||
*/
|
||||
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
|
||||
$this->moduleHandler = $module_handler;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\migrate_drupal\Unit\source\d6\TestNodeRevision.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
|
||||
|
||||
use Drupal\Core\Database\Connection;
|
||||
use Drupal\Core\Extension\ModuleHandlerInterface;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\d6\NodeRevision;
|
||||
|
||||
/**
|
||||
* Provides a node revision source plugin used for unit testing.
|
||||
*/
|
||||
class TestNodeRevision extends NodeRevision {
|
||||
|
||||
/**
|
||||
* Sets the database connection for this source plugin.
|
||||
*
|
||||
* @param \Drupal\Core\Database\Connection $database
|
||||
*/
|
||||
public function setDatabase(Connection $database) {
|
||||
$this->database = $database;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the module handler for this source plugin.
|
||||
*
|
||||
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
|
||||
*/
|
||||
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
|
||||
$this->moduleHandler = $module_handler;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\migrate_drupal\Unit\source\d6\TestTerm.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
|
||||
|
||||
use Drupal\Core\Database\Connection;
|
||||
use Drupal\Core\Extension\ModuleHandlerInterface;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\d6\Term;
|
||||
|
||||
class TestTerm extends Term {
|
||||
public function setDatabase(Connection $database) {
|
||||
$this->database = $database;
|
||||
}
|
||||
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
|
||||
$this->moduleHandler = $module_handler;
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\migrate_drupal\Unit\source\d6\UserPictureTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
|
||||
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
||||
/**
|
||||
* Tests D6 user picture source plugin.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class UserPictureTest extends MigrateSqlSourceTestCase {
|
||||
|
||||
const PLUGIN_CLASS = 'Drupal\migrate_drupal\Plugin\migrate\source\d6\UserPicture';
|
||||
|
||||
protected $migrationConfiguration = array(
|
||||
'id' => 'test_user_picture',
|
||||
'idlist' => array(),
|
||||
'source' => array(
|
||||
'plugin' => 'd6_user_picture',
|
||||
),
|
||||
);
|
||||
|
||||
protected $expectedResults = array(
|
||||
array(
|
||||
'uid' => 1,
|
||||
'access' => 1382835435,
|
||||
'picture' => 'sites/default/files/pictures/picture-1.jpg',
|
||||
),
|
||||
array(
|
||||
'uid' => 2,
|
||||
'access' => 1382835436,
|
||||
'picture' => 'sites/default/files/pictures/picture-2.jpg',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
$this->databaseContents['users'] = $this->expectedResults;
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\migrate_drupal\Unit\source\d6\UserTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
|
||||
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
||||
/**
|
||||
* Tests D6 user source plugin.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class UserTest extends MigrateSqlSourceTestCase {
|
||||
|
||||
const PLUGIN_CLASS = 'Drupal\migrate_drupal\Plugin\migrate\source\d6\User';
|
||||
|
||||
protected $migrationConfiguration = array(
|
||||
'id' => 'test',
|
||||
'idlist' => array(),
|
||||
'source' => array(
|
||||
'plugin' => 'd6_user',
|
||||
),
|
||||
);
|
||||
|
||||
protected $expectedResults = array(
|
||||
array(
|
||||
'uid' => 2,
|
||||
'name' => 'admin',
|
||||
// @todo d6 hash?
|
||||
'pass' => '1234',
|
||||
'mail' => 'admin@example.com',
|
||||
'theme' => '',
|
||||
'signature' => '',
|
||||
'signature_format' => 0,
|
||||
'created' => 1279402616,
|
||||
'access' => 1322981278,
|
||||
'login' => 1322699994,
|
||||
'status' => 0,
|
||||
'timezone' => 'America/Lima',
|
||||
'language' => 'en',
|
||||
// @todo Add the file when needed.
|
||||
'picture' => 'sites/default/files/pictures/picture-1.jpg',
|
||||
'init' => 'admin@example.com',
|
||||
'data' => NULL,
|
||||
),
|
||||
array(
|
||||
'uid' => 4,
|
||||
'name' => 'alice',
|
||||
// @todo d6 hash?
|
||||
'pass' => '1234',
|
||||
'mail' => 'alice@example.com',
|
||||
'theme' => '',
|
||||
'signature' => '',
|
||||
'signature_format' => 0,
|
||||
'created' => 1322981368,
|
||||
'access' => 1322982419,
|
||||
'login' => 132298140,
|
||||
'status' => 0,
|
||||
'timezone' => 'America/Lima',
|
||||
'language' => 'en',
|
||||
'picture' => '',
|
||||
'init' => 'alice@example.com',
|
||||
'data' => NULL,
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
foreach ($this->expectedResults as $k => $row) {
|
||||
$this->databaseContents['users'][$k] = $row;
|
||||
}
|
||||
// getDatabase() will not create empty tables, so we need to insert data
|
||||
// even if it's irrelevant to the test.
|
||||
$this->databaseContents['users_roles'] = array(
|
||||
array(
|
||||
'uid' => 99,
|
||||
'rid' => 99,
|
||||
),
|
||||
);
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue