当前位置: 首页>>代码示例>>PHP>>正文


PHP MigrateDrupalTestBase::setUp方法代码示例

本文整理汇总了PHP中Drupal\migrate_drupal\Tests\MigrateDrupalTestBase::setUp方法的典型用法代码示例。如果您正苦于以下问题:PHP MigrateDrupalTestBase::setUp方法的具体用法?PHP MigrateDrupalTestBase::setUp怎么用?PHP MigrateDrupalTestBase::setUp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\migrate_drupal\Tests\MigrateDrupalTestBase的用法示例。


在下文中一共展示了MigrateDrupalTestBase::setUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $migration = entity_load('migration', 'd6_user_picture_field');
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:10,代码来源:MigrateUserPictureFieldTest.php

示例2: 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() . '/Drupal6Node.php', $this->getDumpDirectory() . '/Drupal6Upload.php');
     $this->loadDumps($dumps);
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:38,代码来源:MigrateUploadBase.php

示例3: 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() . '/Drupal6Node.php', $this->getDumpDirectory() . '/Drupal6TermNode.php', $this->getDumpDirectory() . '/Drupal6TaxonomyTerm.php', $this->getDumpDirectory() . '/Drupal6TaxonomyVocabulary.php');
     $this->loadDumps($dumps);
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:32,代码来源:MigrateTermNodeTestBase.php

示例4: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('node');
     // Need at least one node type present.
     NodeType::create(['type' => 'testnodetype', 'name' => 'Test node type'])->save();
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:10,代码来源:MigrateNodeStubTest.php

示例5: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Create some fields so the data gets stored.
     entity_create('field_storage_config', array('entity_type' => 'user', 'field_name' => 'profile_color', 'type' => 'text'))->save();
     entity_create('field_storage_config', array('entity_type' => 'user', 'field_name' => 'profile_biography', 'type' => 'text_long'))->save();
     entity_create('field_storage_config', array('entity_type' => 'user', 'field_name' => 'profile_sell_address', 'type' => 'boolean'))->save();
     entity_create('field_storage_config', array('entity_type' => 'user', 'field_name' => 'profile_sold_to', 'type' => 'list_string', 'settings' => array('allowed_values' => array('Pill spammers' => 'Pill spammers', 'Fitness spammers' => 'Fitness spammers'))))->save();
     entity_create('field_storage_config', array('entity_type' => 'user', 'field_name' => 'profile_bands', 'type' => 'text', 'cardinality' => -1))->save();
     entity_create('field_storage_config', array('entity_type' => 'user', 'field_name' => 'profile_blog', 'type' => 'link'))->save();
     entity_create('field_storage_config', array('entity_type' => 'user', 'field_name' => 'profile_birthdate', 'type' => 'datetime'))->save();
     entity_create('field_storage_config', array('entity_type' => 'user', 'field_name' => 'profile_love_migrations', 'type' => 'boolean'))->save();
     // Create the field instances.
     foreach (Drupal6UserProfileFields::getData('profile_fields') as $field) {
         entity_create('field_config', array('label' => $field['title'], 'description' => '', 'field_name' => $field['name'], 'entity_type' => 'user', 'bundle' => 'user', 'required' => 0))->save();
     }
     // Create some users to migrate the profile data to.
     foreach (Drupal6User::getData('users') as $u) {
         $user = entity_create('user', $u);
         $user->enforceIsNew();
         $user->save();
     }
     // Add some id mappings for the dependant migrations.
     $id_mappings = array('d6_user_profile_field_instance' => array(array(array(1), array('user', 'user', 'fieldname'))), 'd6_user_profile_entity_display' => array(array(array(1), array('user', 'user', 'default', 'fieldname'))), 'd6_user_profile_entity_form_display' => array(array(array(1), array('user', 'user', 'default', 'fieldname'))), 'd6_user' => array(array(array(2), array(2)), array(array(8), array(8)), array(array(15), array(15))));
     $this->prepareMigrations($id_mappings);
     // Load database dumps to provide source data.
     $dumps = array($this->getDumpDirectory() . '/Drupal6UserProfileFields.php', $this->getDumpDirectory() . '/Drupal6User.php');
     $this->loadDumps($dumps);
     // Migrate profile fields.
     $migration_format = entity_load('migration', 'd6_profile_values:user');
     $executable = new MigrateExecutable($migration_format, $this);
     $executable->import();
 }
开发者ID:anyforsoft,项目名称:csua_d8,代码行数:36,代码来源:MigrateUserProfileValuesTest.php

示例6: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('shortcut');
     // Make sure the 'default' shortcut_set is installed.
     $this->installConfig(['shortcut']);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:10,代码来源:MigrateShortcutStubTest.php

示例7: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $migration = entity_load('migration', 'd6_node_type');
     $dumps = array($this->getDumpDirectory() . '/Drupal6NodeType.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:12,代码来源:MigrateNodeTypeTest.php

示例8: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $migration = entity_load('migration', 'd6_file_settings');
     $dumps = array($this->getDumpDirectory() . '/Drupal6FileSettings.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, new MigrateMessage());
     $executable->import();
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:12,代码来源:MigrateFileConfigsTest.php

示例9: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $migration = entity_load('migration', 'd6_system_cron');
     $dumps = array($this->getDumpDirectory() . '/Drupal6SystemCron.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, new MigrateMessage());
     $executable->import();
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:12,代码来源:MigrateSystemCronTest.php

示例10: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $migration = entity_load('migration', 'd6_taxonomy_vocabulary');
     $dumps = array($this->getDumpDirectory() . '/Drupal6TaxonomyVocabulary.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:12,代码来源:MigrateTaxonomyVocabularyTest.php

示例11: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $id_mappings = array('d6_user_picture_field_instance' => array(array(array(1), array('user', 'user', 'user_picture'))));
     $this->prepareMigrations($id_mappings);
     $migration = entity_load('migration', 'd6_user_picture_entity_form_display');
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:12,代码来源:MigrateUserPictureEntityFormDisplayTest.php

示例12: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     /** @var \Drupal\migrate\entity\Migration $migration */
     $migration = entity_load('migration', 'd6_comment_type');
     $dumps = array($this->getDumpDirectory() . '/Drupal6CommentVariable.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:13,代码来源:MigrateCommentTypeTest.php

示例13: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->prepareMigrations(array('d6_taxonomy_vocabulary' => array(array(array(1), array('vocabulary_1_i_0_')))));
     $migration = entity_load('migration', 'd6_forum_settings');
     $dumps = array($this->getDumpDirectory() . '/Drupal6ForumSettings.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
开发者ID:anyforsoft,项目名称:csua_d8,代码行数:13,代码来源:MigrateForumConfigsTest.php

示例14: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     /** @var \Drupal\migrate\entity\Migration $migration */
     $migration = entity_load('migration', 'd6_date_formats');
     $dumps = array($this->getDumpDirectory() . '/Drupal6DateFormat.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, new MigrateMessage());
     $executable->import();
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:13,代码来源:MigrateDateFormatTest.php

示例15: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     /** @var \Drupal\migrate\entity\Migration $migration */
     $migration = entity_load('migration', 'd6_field');
     $dumps = array($this->getDumpDirectory() . '/Drupal6FieldInstance.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:13,代码来源:MigrateFieldTest.php


注:本文中的Drupal\migrate_drupal\Tests\MigrateDrupalTestBase::setUp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。