本文整理汇总了PHP中Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase类的典型用法代码示例。如果您正苦于以下问题:PHP MigrateDrupal6TestBase类的具体用法?PHP MigrateDrupal6TestBase怎么用?PHP MigrateDrupal6TestBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MigrateDrupal6TestBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->installEntitySchema('file');
$this->installEntitySchema('node');
$this->installSchema('file', ['file_usage']);
$this->installSchema('node', ['node_access']);
$id_mappings = array('d6_file' => array());
// Create new file entities.
for ($i = 1; $i <= 3; $i++) {
$file = File::create(array('fid' => $i, 'uid' => 1, 'filename' => 'druplicon.txt', 'uri' => "public://druplicon-{$i}.txt", 'filemime' => 'text/plain', 'created' => 1, 'changed' => 1, 'status' => FILE_STATUS_PERMANENT));
$file->enforceIsNew();
file_put_contents($file->getFileUri(), 'hello world');
// Save it, inserting a new record.
$file->save();
$id_mappings['d6_file'][] = array(array($i), array($i));
}
$this->prepareMigrations($id_mappings);
$this->migrateContent();
// Since we are only testing a subset of the file migration, do not check
// that the full file migration has been run.
$migration = Migration::load('d6_upload');
$migration->set('requirements', []);
$this->executeMigration($migration);
}
示例2: setUp
/**
* {@inheritdoc}
*/
public function setUp()
{
parent::setUp();
// Setup the bundles.
entity_create('node_type', array('type' => 'test_page'))->save();
entity_create('node_type', array('type' => 'test_planet'))->save();
entity_create('node_type', array('type' => 'test_story'))->save();
entity_create('node_type', array('type' => 'test_event'))->save();
entity_create('node_type', array('type' => 'story'))->save();
entity_create('node_type', array('type' => 'article'))->save();
entity_create('node_type', array('type' => 'company'))->save();
entity_create('node_type', array('type' => 'employee'))->save();
entity_create('node_type', array('type' => 'page'))->save();
entity_create('node_type', array('type' => 'sponsor'))->save();
entity_create('node_type', array('type' => 'event'))->save();
entity_create('node_type', array('type' => 'book'))->save();
// Create a config entity that already exists.
entity_create('base_field_override', array('field_name' => 'promote', 'entity_type' => 'node', 'bundle' => 'page'))->save();
$id_mappings = array('d6_node_type' => array(array(array('test_page'), array('test_page')), array(array('test_planet'), array('test_planet')), array(array('test_story'), array('test_story')), array(array('test_event'), array('test_event')), array(array('story'), array('story'))));
$this->prepareMigrations($id_mappings);
// Setup the dumps.
$migration = entity_load('migration', 'd6_node_setting_promote');
$dumps = array($this->getDumpDirectory() . '/NodeType.php', $this->getDumpDirectory() . '/Variable.php');
$this->prepare($migration, $dumps);
// Run the migrations.
$executable = new MigrateExecutable($migration, $this);
$executable->import();
$migration = entity_load('migration', 'd6_node_setting_status');
$executable = new MigrateExecutable($migration, $this);
$executable->import();
$migration = entity_load('migration', 'd6_node_setting_sticky');
$executable = new MigrateExecutable($migration, $this);
$executable->import();
}
示例3: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->installConfig(array('node'));
$this->loadDumps(['NodeType.php', 'Variable.php']);
$this->executeMigration('d6_node_type');
}
示例4: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->installSchema('system', ['url_alias']);
$this->loadDumps(['UrlAlias.php']);
$this->executeMigration('d6_url_alias');
}
示例5: setUp
/**
* {@inheritdoc}
*/
public function setUp()
{
parent::setUp();
// Setup the bundles.
entity_create('node_type', array('type' => 'test_page'))->save();
entity_create('node_type', array('type' => 'test_planet'))->save();
entity_create('node_type', array('type' => 'test_story'))->save();
entity_create('node_type', array('type' => 'test_event'))->save();
entity_create('node_type', array('type' => 'story'))->save();
entity_create('node_type', array('type' => 'article'))->save();
entity_create('node_type', array('type' => 'company'))->save();
entity_create('node_type', array('type' => 'employee'))->save();
entity_create('node_type', array('type' => 'page'))->save();
entity_create('node_type', array('type' => 'sponsor'))->save();
entity_create('node_type', array('type' => 'event'))->save();
entity_create('node_type', array('type' => 'book'))->save();
// Create a config entity that already exists.
entity_create('base_field_override', array('field_name' => 'promote', 'entity_type' => 'node', 'bundle' => 'page'))->save();
$id_mappings = array('d6_node_type' => array(array(array('test_page'), array('test_page')), array(array('test_planet'), array('test_planet')), array(array('test_story'), array('test_story')), array(array('test_event'), array('test_event')), array(array('story'), array('story'))));
$this->prepareMigrations($id_mappings);
$this->loadDumps(['NodeType.php', 'Variable.php']);
$this->executeMigration('d6_node_setting_promote');
$this->executeMigration('d6_node_setting_status');
$this->executeMigration('d6_node_setting_sticky');
}
示例6: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->executeMigrations(['user_profile_field', 'user_profile_field_instance', 'user_profile_entity_display', 'user_profile_entity_form_display']);
$this->migrateUsers(FALSE);
$this->executeMigration('d6_profile_values');
}
示例7: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->installEntitySchema('node');
$this->installConfig(['node']);
$this->installSchema('node', ['node_access']);
$this->installSchema('system', ['sequences']);
// Create a new user which needs to have UID 1, because that is expected by
// the assertions from
// \Drupal\migrate_drupal\Tests\d6\MigrateNodeRevisionTest.
User::create(['uid' => 1, 'name' => $this->randomMachineName(), 'status' => 1])->enforceIsNew(TRUE)->save();
$node_type = entity_create('node_type', array('type' => 'test_planet'));
$node_type->save();
node_add_body_field($node_type);
$node_type = entity_create('node_type', array('type' => 'story'));
$node_type->save();
node_add_body_field($node_type);
$id_mappings = array('d6_node_type' => array(array(array('test_story'), array('story'))), 'd6_filter_format' => array(array(array(1), array('filtered_html')), array(array(2), array('full_html'))), 'd6_user' => array(array(array(1), array(1)), array(array(2), array(2))), 'd6_field_instance_widget_settings' => array(array(array('page', 'field_test'), array('node', 'page', 'default', 'test'))), 'd6_field_formatter_settings' => array(array(array('page', 'default', 'node', 'field_test'), array('node', 'page', 'default', 'field_test'))));
$this->prepareMigrations($id_mappings);
$migration = entity_load('migration', 'd6_node_settings');
$migration->setMigrationResult(MigrationInterface::RESULT_COMPLETED);
// Create a test node.
$node = entity_create('node', array('type' => 'story', 'nid' => 1, 'vid' => 1, 'revision_log' => '', 'title' => $this->randomString()));
$node->enforceIsNew();
$node->save();
$node = entity_create('node', array('type' => 'test_planet', 'nid' => 3, 'vid' => 4, 'revision_log' => '', 'title' => $this->randomString()));
$node->enforceIsNew();
$node->save();
}
示例8: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
// Create new file entities.
for ($i = 1; $i <= 3; $i++) {
$file = entity_create('file', array('fid' => $i, 'uid' => 1, 'filename' => 'druplicon.txt', 'uri' => "public://druplicon-{$i}.txt", 'filemime' => 'text/plain', 'created' => 1, 'changed' => 1, 'status' => FILE_STATUS_PERMANENT));
$file->enforceIsNew();
file_put_contents($file->getFileUri(), 'hello world');
// Save it, inserting a new record.
$file->save();
$id_mappings['d6_file'][] = array(array($i), array($i));
}
// Add a node type.
$node_type = entity_create('node_type', array('type' => 'story'));
$node_type->save();
// Add a file field.
entity_create('field_storage_config', array('field_name' => 'upload', 'entity_type' => 'node', 'type' => 'file', 'cardinality' => -1, 'settings' => array('display_field' => TRUE)))->save();
entity_create('field_config', array('field_name' => 'upload', 'entity_type' => 'node', 'bundle' => 'story'))->save();
$id_mappings['d6_node'] = array(array(array(1), array(1)), array(array(2), array(2)));
$this->prepareMigrations($id_mappings);
$vids = array(1, 2, 3);
for ($i = 1; $i <= 2; $i++) {
$node = entity_create('node', array('type' => 'story', 'nid' => $i, 'vid' => array_shift($vids)));
$node->enforceIsNew();
$node->save();
if ($i == 1) {
$node->vid->value = array_shift($vids);
$node->enforceIsNew(FALSE);
$node->isDefaultRevision(FALSE);
$node->save();
}
}
$dumps = array($this->getDumpDirectory() . '/Node.php', $this->getDumpDirectory() . '/NodeRevisions.php', $this->getDumpDirectory() . '/ContentTypeStory.php', $this->getDumpDirectory() . '/ContentTypeTestPlanet.php', $this->getDumpDirectory() . '/Upload.php');
$this->loadDumps($dumps);
}
示例9: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->installEntitySchema('aggregator_feed');
$this->installEntitySchema('aggregator_item');
$this->executeMigrations(['d6_aggregator_feed', 'd6_aggregator_item']);
}
示例10: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->migrateUsers(FALSE);
$this->installSchema('user', ['users_data']);
$this->executeMigration('d6_user_contact_settings');
}
示例11: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->installConfig(['block_content']);
$this->installEntitySchema('block_content');
$this->executeMigrations(['d6_filter_format', 'block_content_type', 'block_content_body_field', 'd6_custom_block']);
}
示例12: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->installEntitySchema('aggregator_feed');
$this->loadDumps(['AggregatorFeed.php']);
$this->executeMigration('d6_aggregator_feed');
}
示例13: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$vocabulary = entity_create('taxonomy_vocabulary', array('vid' => 'test'));
$vocabulary->save();
$node_type = entity_create('node_type', array('type' => 'story'));
$node_type->save();
foreach (array('vocabulary_1_i_0_', 'vocabulary_2_i_1_', 'vocabulary_3_i_2_') as $name) {
entity_create('field_storage_config', array('field_name' => $name, 'entity_type' => 'node', 'type' => 'taxonomy_term_reference', 'cardinality' => -1, 'settings' => array('allowed_values' => array(array('vocabulary' => $vocabulary->id(), 'parent' => '0')))))->save();
entity_create('field_config', array('field_name' => $name, 'entity_type' => 'node', 'bundle' => 'story'))->save();
}
$id_mappings = array('d6_vocabulary_field_instance' => array(array(array(1, 'page'), array('node', 'page', 'test'))), 'd6_vocabulary_entity_display' => array(array(array(1, 'page'), array('node', 'page', 'default', 'test'))), 'd6_vocabulary_entity_form_display' => array(array(array(1, 'page'), array('node', 'page', 'default', 'test'))), 'd6_node' => array(array(array(1), array(1)), array(array(2), array(2))));
$this->prepareMigrations($id_mappings);
$vids = array(1, 2, 3);
for ($i = 1; $i <= 2; $i++) {
$node = entity_create('node', array('type' => 'story', 'nid' => $i, 'vid' => array_shift($vids)));
$node->enforceIsNew();
$node->save();
if ($i == 1) {
$node->vid->value = array_shift($vids);
$node->enforceIsNew(FALSE);
$node->setNewRevision();
$node->isDefaultRevision(FALSE);
$node->save();
}
}
$dumps = array($this->getDumpDirectory() . '/Node.php', $this->getDumpDirectory() . '/NodeRevisions.php', $this->getDumpDirectory() . '/ContentTypeStory.php', $this->getDumpDirectory() . '/ContentTypeTestPlanet.php', $this->getDumpDirectory() . '/TermNode.php', $this->getDumpDirectory() . '/TermHierarchy.php', $this->getDumpDirectory() . '/TermData.php', $this->getDumpDirectory() . '/Vocabulary.php', $this->getDumpDirectory() . '/VocabularyNodeTypes.php');
$this->loadDumps($dumps);
}
示例14: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->installSchema('system', 'router');
$this->container->get('router.builder')->rebuild();
$this->executeMigrations(['d6_user_mail', 'd6_user_settings']);
}
示例15: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->installConfig(['node']);
$this->executeMigration('d6_node_type');
$this->executeMigration('d6_node_setting_promote');
}