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


PHP MigrateExecutable::import方法代码示例

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


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

示例1: 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();
     // 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() . '/ProfileFields.php', $this->getDumpDirectory() . '/Users.php', $this->getDumpDirectory() . '/ProfileValues.php', $this->getDumpDirectory() . '/UsersRoles.php', $this->getDumpDirectory() . '/EventTimezones.php');
     $this->loadDumps($dumps);
     $field_data = Database::getConnection('default', 'migrate')->select('profile_fields', 'u')->fields('u')->execute()->fetchAll();
     // Create the field instances.
     foreach ($field_data as $field) {
         entity_create('field_config', array('label' => $field->title, 'description' => '', 'field_name' => $field->name, 'entity_type' => 'user', 'bundle' => 'user', 'required' => 0))->save();
     }
     // Create our users for the node authors.
     $query = Database::getConnection('default', 'migrate')->query('SELECT * FROM {users} WHERE uid NOT IN (0, 1)');
     while (($row = $query->fetchAssoc()) !== FALSE) {
         $user = entity_create('user', $row);
         $user->enforceIsNew();
         $user->save();
     }
     // Migrate profile fields.
     $migration_format = entity_load('migration', 'd6_profile_values:user');
     $executable = new MigrateExecutable($migration_format, $this);
     $executable->import();
 }
开发者ID:dev981,项目名称:gaptest,代码行数:38,代码来源:MigrateUserProfileValuesTest.php

示例2: testNode

 /**
  * Test node migration from Drupal 6 to 8.
  */
 public function testNode()
 {
     $node = node_load(1);
     $this->assertEqual($node->id(), 1, 'Node 1 loaded.');
     $this->assertEqual($node->body->value, 'test');
     $this->assertEqual($node->body->format, 'filtered_html');
     $this->assertEqual($node->getType(), 'story', 'Node has the correct bundle.');
     $this->assertEqual($node->getTitle(), 'Test title', 'Node has the correct title.');
     $this->assertEqual($node->getCreatedTime(), 1388271197, 'Node has the correct created time.');
     $this->assertEqual($node->isSticky(), FALSE);
     $this->assertEqual($node->getOwnerId(), 1);
     //$this->assertEqual($node->getRevisionCreationTime(), 1390095701, 'Node has the correct revision timestamp.');
     // It is pointless to run the second half from MigrateDrupal6Test.
     if (empty($this->standalone)) {
         return;
     }
     // Test that we can re-import using the EntityContentBase destination.
     $connection = Database::getConnection('default', 'migrate');
     $connection->update('node_revisions')->fields(array('title' => 'New node title', 'format' => 2))->condition('vid', 1)->execute();
     $connection->delete('content_field_test_two')->condition('delta', 1)->execute();
     /** @var \Drupal\migrate\entity\Migration $migration */
     $migration = entity_load('migration', 'd6_node');
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
     $node = node_load(1);
     $this->assertEqual($node->getTitle(), 'New node title');
     // Test a multi-column fields are correctly upgraded.
     $this->assertEqual($node->body->value, 'test');
     $this->assertEqual($node->body->format, 'full_html');
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:33,代码来源:MigrateNodeTest.php

示例3: testRollback

 /**
  * Tests rolling back configuration and content entities.
  */
 public function testRollback()
 {
     // We use vocabularies to demonstrate importing and rolling back
     // configuration entities.
     $vocabulary_data_rows = [['id' => '1', 'name' => 'categories', 'weight' => '2'], ['id' => '2', 'name' => 'tags', 'weight' => '1']];
     $ids = ['id' => ['type' => 'integer']];
     $config = ['id' => 'vocabularies', 'migration_tags' => ['Import and rollback test'], 'source' => ['plugin' => 'embedded_data', 'data_rows' => $vocabulary_data_rows, 'ids' => $ids], 'process' => ['vid' => 'id', 'name' => 'name', 'weight' => 'weight'], 'destination' => ['plugin' => 'entity:taxonomy_vocabulary']];
     $vocabulary_migration = Migration::create($config);
     $vocabulary_id_map = $vocabulary_migration->getIdMap();
     $this->assertTrue($vocabulary_migration->getDestinationPlugin()->supportsRollback());
     // Import and validate vocabulary config entities were created.
     $vocabulary_executable = new MigrateExecutable($vocabulary_migration, $this);
     $vocabulary_executable->import();
     foreach ($vocabulary_data_rows as $row) {
         /** @var Vocabulary $vocabulary */
         $vocabulary = Vocabulary::load($row['id']);
         $this->assertTrue($vocabulary);
         $map_row = $vocabulary_id_map->getRowBySource(['id' => $row['id']]);
         $this->assertNotNull($map_row['destid1']);
     }
     // We use taxonomy terms to demonstrate importing and rolling back
     // content entities.
     $term_data_rows = [['id' => '1', 'vocab' => '1', 'name' => 'music'], ['id' => '2', 'vocab' => '2', 'name' => 'Bach'], ['id' => '3', 'vocab' => '2', 'name' => 'Beethoven']];
     $ids = ['id' => ['type' => 'integer']];
     $config = ['id' => 'terms', 'migration_tags' => ['Import and rollback test'], 'source' => ['plugin' => 'embedded_data', 'data_rows' => $term_data_rows, 'ids' => $ids], 'process' => ['tid' => 'id', 'vid' => 'vocab', 'name' => 'name'], 'destination' => ['plugin' => 'entity:taxonomy_term'], 'migration_dependencies' => ['required' => ['vocabularies']]];
     $term_migration = Migration::create($config);
     $term_id_map = $term_migration->getIdMap();
     $this->assertTrue($term_migration->getDestinationPlugin()->supportsRollback());
     // Import and validate term entities were created.
     $term_executable = new MigrateExecutable($term_migration, $this);
     $term_executable->import();
     foreach ($term_data_rows as $row) {
         /** @var Term $term */
         $term = Term::load($row['id']);
         $this->assertTrue($term);
         $map_row = $term_id_map->getRowBySource(['id' => $row['id']]);
         $this->assertNotNull($map_row['destid1']);
     }
     // Rollback and verify the entities are gone.
     $term_executable->rollback();
     foreach ($term_data_rows as $row) {
         $term = Term::load($row['id']);
         $this->assertNull($term);
         $map_row = $term_id_map->getRowBySource(['id' => $row['id']]);
         $this->assertFalse($map_row);
     }
     $vocabulary_executable->rollback();
     foreach ($vocabulary_data_rows as $row) {
         $term = Vocabulary::load($row['id']);
         $this->assertNull($term);
         $map_row = $vocabulary_id_map->getRowBySource(['id' => $row['id']]);
         $this->assertFalse($map_row);
     }
     // Test that simple configuration is not rollbackable.
     $term_setting_rows = [['id' => 1, 'override_selector' => '0', 'terms_per_page_admin' => '10']];
     $ids = ['id' => ['type' => 'integer']];
     $config = ['id' => 'taxonomy_settings', 'migration_tags' => ['Import and rollback test'], 'source' => ['plugin' => 'embedded_data', 'data_rows' => $term_setting_rows, 'ids' => $ids], 'process' => ['override_selector' => 'override_selector', 'terms_per_page_admin' => 'terms_per_page_admin'], 'destination' => ['plugin' => 'config', 'config_name' => 'taxonomy.settings'], 'migration_dependencies' => ['required' => ['vocabularies']]];
     $settings_migration = Migration::create($config);
     $this->assertFalse($settings_migration->getDestinationPlugin()->supportsRollback());
 }
开发者ID:HakS,项目名称:drupal8_training,代码行数:63,代码来源:MigrateRollbackTest.php

示例4: testStubWithWeightMapping

 /**
  * Tests creation of stubs when weight is mapped.
  */
 public function testStubWithWeightMapping()
 {
     // Create a vocabulary via migration for the terms to reference.
     $vocabulary_data_rows = [['id' => '1', 'name' => 'tags']];
     $ids = ['id' => ['type' => 'integer']];
     $config = ['id' => 'vocabularies', 'migration_tags' => ['Stub test'], 'source' => ['plugin' => 'embedded_data', 'data_rows' => $vocabulary_data_rows, 'ids' => $ids], 'process' => ['vid' => 'id', 'name' => 'name'], 'destination' => ['plugin' => 'entity:taxonomy_vocabulary']];
     $vocabulary_migration = Migration::create($config);
     $vocabulary_executable = new MigrateExecutable($vocabulary_migration, $this);
     $vocabulary_executable->import();
     // We have a term referencing an unmigrated parent, forcing a stub to be
     // created.
     $term_data_rows = [['id' => '1', 'vocab' => '1', 'name' => 'music', 'parent' => '2']];
     $ids = ['id' => ['type' => 'integer']];
     $config = ['id' => 'terms', 'migration_tags' => ['Import and rollback test'], 'source' => ['plugin' => 'embedded_data', 'data_rows' => $term_data_rows, 'ids' => $ids], 'process' => ['tid' => 'id', 'vid' => 'vocab', 'name' => 'name', 'weight' => 'weight', 'parent' => ['plugin' => 'migration', 'migration' => 'terms', 'source' => 'parent']], 'destination' => ['plugin' => 'entity:taxonomy_term'], 'migration_dependencies' => ['required' => ['vocabularies']]];
     $term_migration = Migration::create($config);
     $term_migration->save();
     $term_executable = new MigrateExecutable($term_migration, $this);
     $term_executable->import();
     // Load the referenced term, which should exist as a stub.
     /** @var \Drupal\Core\Entity\ContentEntityBase $stub_entity */
     $stub_entity = Term::load(2);
     $this->assertTrue($stub_entity, 'Stub successfully created');
     if ($stub_entity) {
         $this->assertIdentical(count($stub_entity->validate()), 0, 'Stub is a valid entity');
     }
 }
开发者ID:neetumorwani,项目名称:blogging,代码行数:29,代码来源:MigrateTaxonomyTermStubTest.php

示例5: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('file');
     $this->installSchema('file', ['file_usage']);
     // Create the user profile field and instance.
     entity_create('field_storage_config', array('entity_type' => 'user', 'field_name' => 'user_picture', 'type' => 'image', 'translatable' => '0'))->save();
     entity_create('field_config', array('label' => 'User Picture', 'description' => '', 'field_name' => 'user_picture', 'entity_type' => 'user', 'bundle' => 'user', 'required' => 0))->save();
     $file = entity_create('file', array('fid' => 2, 'uid' => 2, 'filename' => 'image-test.jpg', 'uri' => "public://image-test.jpg", 'filemime' => 'image/jpeg', 'created' => 1, 'changed' => 1, 'status' => FILE_STATUS_PERMANENT));
     $file->enforceIsNew();
     file_put_contents($file->getFileUri(), file_get_contents('core/modules/simpletest/files/image-1.png'));
     $file->save();
     $file = entity_create('file', array('fid' => 8, 'uid' => 8, 'filename' => 'image-test.png', 'uri' => "public://image-test.png", 'filemime' => 'image/png', 'created' => 1, 'changed' => 1, 'status' => FILE_STATUS_PERMANENT));
     $file->enforceIsNew();
     file_put_contents($file->getFileUri(), file_get_contents('core/modules/simpletest/files/image-2.jpg'));
     $file->save();
     // Load database dumps to provide source data.
     $dumps = array($this->getDumpDirectory() . '/Filters.php', $this->getDumpDirectory() . '/FilterFormats.php', $this->getDumpDirectory() . '/Variable.php', $this->getDumpDirectory() . '/ProfileFields.php', $this->getDumpDirectory() . '/Permission.php', $this->getDumpDirectory() . '/Role.php', $this->getDumpDirectory() . '/Users.php', $this->getDumpDirectory() . '/ProfileValues.php', $this->getDumpDirectory() . '/UsersRoles.php', $this->getDumpDirectory() . '/EventTimezones.php');
     $this->loadDumps($dumps);
     $id_mappings = array('d6_user_role' => array(array(array(1), array('anonymous user')), array(array(2), array('authenticated user')), array(array(3), array('migrate test role 1')), array(array(4), array('migrate test role 2')), array(array(5), array('migrate test role 3'))), 'd6_user_picture_entity_display' => array(array(array(1), array('user', 'user', 'default', 'user_picture'))), 'd6_user_picture_entity_form_display' => array(array(array(1), array('user', 'user', 'default', 'user_picture'))), 'd6_user_picture_file' => array(array(array(2), array(2)), array(array(8), array(8))));
     $this->prepareMigrations($id_mappings);
     // Migrate users.
     $migration = entity_load('migration', 'd6_user');
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:29,代码来源:MigrateUserTest.php

示例6: 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

示例7: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     entity_create('field_storage_config', array('entity_type' => 'node', 'field_name' => 'field_test', 'type' => 'text'))->save();
     entity_create('field_config', array('entity_type' => 'node', 'field_name' => 'field_test', 'bundle' => 'story'))->save();
     entity_create('field_storage_config', array('entity_type' => 'node', 'field_name' => 'field_test_two', 'type' => 'integer', 'cardinality' => -1))->save();
     entity_create('field_config', array('entity_type' => 'node', 'field_name' => 'field_test_two', 'bundle' => 'story'))->save();
     entity_create('field_storage_config', array('entity_type' => 'node', 'field_name' => 'field_test_three', 'type' => 'decimal'))->save();
     entity_create('field_config', array('entity_type' => 'node', 'field_name' => 'field_test_three', 'bundle' => 'story'))->save();
     entity_create('field_storage_config', array('entity_type' => 'node', 'field_name' => 'field_test_integer_selectlist', 'type' => 'integer'))->save();
     entity_create('field_config', array('entity_type' => 'node', 'field_name' => 'field_test_integer_selectlist', 'bundle' => 'story'))->save();
     entity_create('field_storage_config', array('entity_type' => 'node', 'field_name' => 'field_test_exclude_unset', 'type' => 'text'))->save();
     entity_create('field_config', array('entity_type' => 'node', 'field_name' => 'field_test_exclude_unset', 'bundle' => 'story'))->save();
     entity_create('field_storage_config', array('entity_type' => 'node', 'field_name' => 'field_multivalue', 'type' => 'decimal', 'precision' => '10', 'scale' => '2', 'cardinality' => -1))->save();
     entity_create('field_config', array('entity_type' => 'node', 'field_name' => 'field_multivalue', 'bundle' => 'test_planet'))->save();
     entity_create('field_storage_config', array('entity_type' => 'node', 'field_name' => 'field_test_identical1', 'type' => 'integer'))->save();
     entity_create('field_config', array('entity_type' => 'node', 'field_name' => 'field_test_identical1', 'bundle' => 'story'))->save();
     entity_create('field_storage_config', array('entity_type' => 'node', 'field_name' => 'field_test_identical2', 'type' => 'integer'))->save();
     entity_create('field_config', array('entity_type' => 'node', 'field_name' => 'field_test_identical2', 'bundle' => 'story'))->save();
     entity_create('field_storage_config', array('entity_type' => 'node', 'field_name' => 'field_test_link', 'type' => 'link'))->save();
     entity_create('field_config', array('entity_type' => 'node', 'field_name' => 'field_test_link', 'bundle' => 'story'))->save();
     entity_create('field_storage_config', array('entity_type' => 'node', 'field_name' => 'field_test_filefield', 'type' => 'file'))->save();
     entity_create('field_config', array('entity_type' => 'node', 'field_name' => 'field_test_filefield', 'bundle' => 'story'))->save();
     // Add some id mappings for the dependant migrations.
     $id_mappings = array('d6_field_formatter_settings' => array(array(array('page', 'default', 'node', 'field_test'), array('node', 'page', 'default', 'field_test'))), 'd6_field_instance_widget_settings' => array(array(array('page', 'field_test'), array('node', 'page', 'default', 'test'))), 'd6_node' => array(array(array(1), array(1)), array(array(2), array(2)), array(array(3), array(3))));
     $this->prepareMigrations($id_mappings);
     $migrations = entity_load_multiple('migration', array('d6_cck_field_values:*'));
     foreach ($migrations as $migration) {
         $executable = new MigrateExecutable($migration, $this);
         $executable->import();
     }
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:35,代码来源:MigrateCckFieldValuesTest.php

示例8: 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();
 }
开发者ID:dev981,项目名称:gaptest,代码行数:37,代码来源:MigrateNodeBundleSettingsTest.php

示例9: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $migration = entity_load('migration', 'd6_upload_field');
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
开发者ID:RealLukeMartin,项目名称:drupal8tester,代码行数:10,代码来源:MigrateUploadFieldTest.php

示例10: testFiles

 /**
  * Tests the Drupal 6 files to Drupal 8 migration.
  */
 public function testFiles()
 {
     /** @var \Drupal\file\FileInterface $file */
     $file = entity_load('file', 1);
     $this->assertIdentical('Image1.png', $file->getFilename());
     $this->assertIdentical('39325', $file->getSize());
     $this->assertIdentical('public://image-1.png', $file->getFileUri());
     $this->assertIdentical('image/png', $file->getMimeType());
     // It is pointless to run the second half from MigrateDrupal6Test.
     if (empty($this->standalone)) {
         return;
     }
     // Test that we can re-import and also test with file_directory_path set.
     db_truncate(entity_load('migration', 'd6_file')->getIdMap()->mapTableName())->execute();
     $migration = entity_load_unchanged('migration', 'd6_file');
     $dumps = array($this->getDumpDirectory() . '/Variable.php');
     $this->prepare($migration, $dumps);
     // Update the file_directory_path.
     Database::getConnection('default', 'migrate')->update('variable')->fields(array('value' => serialize('files/test')))->condition('name', 'file_directory_path')->execute();
     Database::getConnection('default', 'migrate')->update('variable')->fields(array('value' => serialize($this->getTempFilesDirectory())))->condition('name', 'file_directory_temp')->execute();
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
     $file = entity_load('file', 2);
     $this->assertIdentical('public://core/modules/simpletest/files/image-2.jpg', $file->getFileUri());
     // Ensure that a temporary file has been migrated.
     $file = entity_load('file', 6);
     $this->assertIdentical('temporary://' . static::getUniqueFilename(), $file->getFileUri());
 }
开发者ID:dev981,项目名称:gaptest,代码行数:31,代码来源:MigrateFileTest.php

示例11: 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

示例12: setUp

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

示例13: setUp

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

示例14: setUp

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

示例15: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $migration = entity_load('migration', 'd6_user_profile_field');
     $dumps = array($this->getDumpDirectory() . '/ProfileFields.php', $this->getDumpDirectory() . '/Users.php', $this->getDumpDirectory() . '/ProfileValues.php', $this->getDumpDirectory() . '/UsersRoles.php', $this->getDumpDirectory() . '/EventTimezones.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:12,代码来源:MigrateUserProfileFieldTest.php


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