• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Entity\Migration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Drupal\migrate\Entity\Migration的典型用法代码示例。如果您正苦于以下问题:PHP Migration类的具体用法?PHP Migration怎么用?PHP Migration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: testCalculateDependencies

 /**
  * @covers ::calculateDependencies
  */
 public function testCalculateDependencies()
 {
     $fixture_migrations = ['d6_node__article' => 'd6_node', 'd6_node__page' => 'd6_node', 'd6_variables' => 'd6_variables'];
     foreach ($fixture_migrations as $id => $template) {
         $values = ['id' => $id, 'template' => $template, 'source' => ['plugin' => 'empty'], 'destination' => ['plugin' => 'null'], 'migration_tags' => []];
         Migration::create($values)->save();
     }
     $values = ['migration_dependencies' => ['required' => ['d6_node:*', 'd6_variables']], 'source' => ['plugin' => 'empty'], 'destination' => ['plugin' => 'null']];
     $migration = new Migration($values, 'migration');
     $expected = ['migrate.migration.d6_node__article', 'migrate.migration.d6_node__page', 'migrate.migration.d6_variables'];
     $migration->calculateDependencies();
     $this->assertEquals($expected, $migration->getDependencies()['config']);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:16,代码来源:MigrationTest.php


示例2: assertEntity

 /**
  * Asserts various aspects of a migration entity.
  *
  * @param string $id
  *   The migration ID.
  * @param string $label
  *   The label.
  */
 protected function assertEntity($id, $label)
 {
     $migration = Migration::load($id);
     $this->assertTrue($migration instanceof Migration);
     $this->assertIdentical($id, $migration->Id());
     $this->assertIdentical($label, $migration->label());
 }
开发者ID:ravindrasingh22,项目名称:Drupal-8-rc,代码行数:15,代码来源:MigrateNodeBuilderTest.php


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


示例4: buildMigrations

 /**
  * {@inheritdoc}
  */
 public function buildMigrations(array $template)
 {
     $migration = Migration::create($template);
     $source_plugin = $migration->getSourcePlugin();
     // The source plugin will throw RequirementsException if CCK is not enabled,
     // in which case there is nothing else for us to do.
     if ($source_plugin instanceof RequirementsInterface) {
         try {
             $source_plugin->checkRequirements();
         } catch (RequirementsException $e) {
             return [$migration];
         }
     }
     // Loop through every field that will be migrated.
     foreach ($source_plugin as $field) {
         $field_type = $field->getSourceProperty('type');
         // Each field type should only be processed once.
         if (in_array($field_type, $this->processedFieldTypes)) {
             continue;
         } elseif ($this->cckPluginManager->hasDefinition($field_type)) {
             $this->processedFieldTypes[] = $field_type;
             // Allow the cckfield plugin to alter the migration as necessary so that
             // it knows how to handle fields of this type.
             $this->cckPluginManager->createInstance($field_type, [], $migration)->{$this->configuration['cck_plugin_method']}($migration);
         }
     }
     return [$migration];
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:31,代码来源:CckMigration.php


示例5: testNode

 /**
  * Test node migration from Drupal 6 to 8.
  */
 public function testNode()
 {
     $node = Node::load(1);
     $this->assertIdentical('1', $node->id(), 'Node 1 loaded.');
     $this->assertIdentical('und', $node->langcode->value);
     $this->assertIdentical('test', $node->body->value);
     $this->assertIdentical('test', $node->body->summary);
     $this->assertIdentical('filtered_html', $node->body->format);
     $this->assertIdentical('story', $node->getType(), 'Node has the correct bundle.');
     $this->assertIdentical('Test title', $node->getTitle(), 'Node has the correct title.');
     $this->assertIdentical('1388271197', $node->getCreatedTime(), 'Node has the correct created time.');
     $this->assertIdentical(FALSE, $node->isSticky());
     $this->assertIdentical('1', $node->getOwnerId());
     $this->assertIdentical('1420861423', $node->getRevisionCreationTime());
     /** @var \Drupal\node\NodeInterface $node_revision */
     $node_revision = \Drupal::entityManager()->getStorage('node')->loadRevision(1);
     $this->assertIdentical('Test title', $node_revision->getTitle());
     $this->assertIdentical('1', $node_revision->getRevisionAuthor()->id(), 'Node revision has the correct user');
     // This is empty on the first revision.
     $this->assertIdentical(NULL, $node_revision->revision_log->value);
     // 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();
     $migration = Migration::load('d6_node__story');
     $this->executeMigration($migration);
     $node = Node::load(1);
     $this->assertIdentical('New node title', $node->getTitle());
     // Test a multi-column fields are correctly upgraded.
     $this->assertIdentical('test', $node->body->value);
     $this->assertIdentical('full_html', $node->body->format);
 }
开发者ID:papillon-cendre,项目名称:d8,代码行数:35,代码来源:MigrateNodeTest.php


示例6: overview

 /**
  * Displays a listing of migration messages.
  *
  * Messages are truncated at 56 chars.
  *
  * @return array
  *   A render array as expected by drupal_render().
  */
 public function overview($migration_group, $migration)
 {
     $rows = [];
     $classes = static::getLogLevelClassMap();
     /** @var MigrationInterface $migration */
     $migration = Migration::load($migration);
     $source_id_field_names = array_keys($migration->getSourcePlugin()->getIds());
     $column_number = 1;
     foreach ($source_id_field_names as $source_id_field_name) {
         $header[] = ['data' => $source_id_field_name, 'field' => 'sourceid' . $column_number++, 'class' => [RESPONSIVE_PRIORITY_MEDIUM]];
     }
     $header[] = ['data' => $this->t('Severity level'), 'field' => 'level', 'class' => [RESPONSIVE_PRIORITY_LOW]];
     $header[] = ['data' => $this->t('Message'), 'field' => 'message'];
     $message_table = $migration->getIdMap()->messageTableName();
     $query = $this->database->select($message_table, 'm')->extend('\\Drupal\\Core\\Database\\Query\\PagerSelectExtender')->extend('\\Drupal\\Core\\Database\\Query\\TableSortExtender');
     $query->fields('m');
     $result = $query->limit(50)->orderByHeader($header)->execute();
     foreach ($result as $message_row) {
         $column_number = 1;
         foreach ($source_id_field_names as $source_id_field_name) {
             $column_name = 'sourceid' . $column_number++;
             $row[$column_name] = $message_row->{$column_name};
         }
         $row['level'] = $message_row->level;
         $row['message'] = $message_row->message;
         $row['class'] = [Html::getClass('migrate-message-' . $message_row->level), $classes[$message_row->level]];
         $rows[] = $row;
     }
     $build['message_table'] = ['#type' => 'table', '#header' => $header, '#rows' => $rows, '#attributes' => ['id' => $message_table, 'class' => [$message_table]], '#empty' => $this->t('No messages for this migration.')];
     $build['message_pager'] = ['#type' => 'pager'];
     return $build;
 }
开发者ID:sheldonrampton,项目名称:drupal8-drops,代码行数:40,代码来源:MessageController.php


示例7: buildMigrations

 /**
  * {@inheritdoc}
  */
 public function buildMigrations(array $template)
 {
     $migrations = [];
     // Read all field instance definitions in the source database.
     $fields = array();
     foreach ($this->getSourcePlugin('d7_field_instance', $template['source']) as $field) {
         $info = $field->getSource();
         $fields[$info['entity_type']][$info['bundle']][$info['field_name']] = $info;
     }
     foreach ($this->getSourcePlugin('d7_node_type', $template['source']) as $node_type) {
         $bundle = $node_type->getSourceProperty('type');
         $values = $template;
         $values['id'] .= '__' . $bundle;
         $values['label'] = $this->t('@label (@type)', ['@label' => $values['label'], '@type' => $node_type->getSourceProperty('name')]);
         $values['source']['node_type'] = $bundle;
         $migration = Migration::create($values);
         if (isset($fields['node'][$bundle])) {
             foreach ($fields['node'][$bundle] as $field => $data) {
                 if ($this->cckPluginManager->hasDefinition($data['type'])) {
                     $this->getCckPlugin($data['type'])->processCckFieldValues($migration, $field, $data);
                 } else {
                     $migration->setProcessOfProperty($field, $field);
                 }
             }
         }
         $migrations[] = $migration;
     }
     return $migrations;
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:32,代码来源:Node.php


示例8: testNodeType

 /**
  * Tests Drupal 6 node type to Drupal 8 migration.
  */
 public function testNodeType()
 {
     $id_map = Migration::load('d6_node_type')->getIdMap();
     // Test the test_page content type.
     $node_type_page = NodeType::load('test_page');
     $this->assertIdentical('test_page', $node_type_page->id(), 'Node type test_page loaded');
     $this->assertIdentical(TRUE, $node_type_page->displaySubmitted());
     $this->assertIdentical(FALSE, $node_type_page->isNewRevision());
     $this->assertIdentical(DRUPAL_OPTIONAL, $node_type_page->getPreviewMode());
     $this->assertIdentical($id_map->lookupDestinationID(array('test_page')), array('test_page'));
     // Test we have a body field.
     $field = FieldConfig::loadByName('node', 'test_page', 'body');
     $this->assertIdentical('This is the body field label', $field->getLabel(), 'Body field was found.');
     // Test the test_story content type.
     $node_type_story = NodeType::load('test_story');
     $this->assertIdentical('test_story', $node_type_story->id(), 'Node type test_story loaded');
     $this->assertIdentical(TRUE, $node_type_story->displaySubmitted());
     $this->assertIdentical(FALSE, $node_type_story->isNewRevision());
     $this->assertIdentical(DRUPAL_OPTIONAL, $node_type_story->getPreviewMode());
     $this->assertIdentical($id_map->lookupDestinationID(array('test_story')), array('test_story'));
     // Test we don't have a body field.
     $field = FieldConfig::loadByName('node', 'test_story', 'body');
     $this->assertIdentical(NULL, $field, 'No body field found');
     // Test the test_event content type.
     $node_type_event = NodeType::load('test_event');
     $this->assertIdentical('test_event', $node_type_event->id(), 'Node type test_event loaded');
     $this->assertIdentical(TRUE, $node_type_event->displaySubmitted());
     $this->assertIdentical(TRUE, $node_type_event->isNewRevision());
     $this->assertIdentical(DRUPAL_OPTIONAL, $node_type_event->getPreviewMode());
     $this->assertIdentical($id_map->lookupDestinationID(array('test_event')), array('test_event'));
     // Test we have a body field.
     $field = FieldConfig::loadByName('node', 'test_event', 'body');
     $this->assertIdentical('Body', $field->getLabel(), 'Body field was found.');
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:37,代码来源:MigrateNodeTypeTest.php


示例9: testEmbeddedData

 /**
  * Tests the embedded_data source plugin.
  */
 public function testEmbeddedData()
 {
     $data_rows = [['key' => '1', 'field1' => 'f1value1', 'field2' => 'f2value1'], ['key' => '2', 'field1' => 'f1value2', 'field2' => 'f2value2']];
     $ids = ['key' => ['type' => 'integer']];
     $config = ['id' => 'sample_data', 'migration_tags' => ['Embedded data test'], 'source' => ['plugin' => 'embedded_data', 'data_rows' => $data_rows, 'ids' => $ids], 'process' => [], 'destination' => ['plugin' => 'null']];
     $migration = Migration::create($config);
     $source = $migration->getSourcePlugin();
     // Validate the plugin returns the source data that was provided.
     $results = [];
     /** @var Row $row */
     foreach ($source as $row) {
         $data_row = $row->getSource();
         // The "data" row returned by getSource() also includes all source
         // configuration - we remove it so we see only the data itself.
         unset($data_row['plugin']);
         unset($data_row['data_rows']);
         unset($data_row['ids']);
         $results[] = $data_row;
     }
     $this->assertIdentical($results, $data_rows);
     // Validate the public APIs.
     $this->assertIdentical($source->count(), count($data_rows));
     $this->assertIdentical($source->getIds(), $ids);
     $expected_fields = ['key' => 'key', 'field1' => 'field1', 'field2' => 'field2'];
     $this->assertIdentical($source->fields(), $expected_fields);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:29,代码来源:MigrateEmbeddedDataTest.php


示例10: buildMigrations

 /**
  * {@inheritdoc}
  */
 public function buildMigrations(array $template)
 {
     $migrations = [];
     $fields = [];
     foreach ($this->getSourcePlugin('d7_field_instance', $template['source']) as $field) {
         $entity_type = $field->getSourceProperty('entity_type');
         $bundle = $field->getSourceProperty('bundle');
         $field_name = $field->getSourceProperty('field_name');
         $fields[$entity_type][$bundle][$field_name] = $field->getSource();
     }
     foreach ($this->getSourcePlugin('d7_node_type', $template['source']) as $node_type) {
         $bundle = $node_type->getSourceProperty('type');
         $values = $template;
         $values['id'] .= '__' . $bundle;
         $values['label'] = $this->t('@label (@type)', ['@label' => $values['label'], '@type' => $node_type->getSourceProperty('name')]);
         $values['source']['node_type'] = $bundle;
         $migration = Migration::create($values);
         if (isset($fields['node'][$bundle])) {
             foreach (array_keys($fields['node'][$bundle]) as $field) {
                 $migration->setProcessOfProperty($field, $field);
             }
         }
         $migrations[] = $migration;
     }
     return $migrations;
 }
开发者ID:ravindrasingh22,项目名称:Drupal-8-rc,代码行数:29,代码来源:Node.php


示例11: testUserRole

 /**
  * Tests user role migration.
  */
 public function testUserRole()
 {
     /** @var \Drupal\migrate\entity\Migration $migration */
     $id_map = Migration::load('d6_user_role')->getIdMap();
     $rid = 'anonymous';
     $anonymous = Role::load($rid);
     $this->assertIdentical($rid, $anonymous->id());
     $this->assertIdentical(array('migrate test anonymous permission', 'use text format filtered_html'), $anonymous->getPermissions());
     $this->assertIdentical(array($rid), $id_map->lookupDestinationId(array(1)));
     $rid = 'authenticated';
     $authenticated = Role::load($rid);
     $this->assertIdentical($rid, $authenticated->id());
     $this->assertIdentical(array('migrate test authenticated permission', 'use text format filtered_html'), $authenticated->getPermissions());
     $this->assertIdentical(array($rid), $id_map->lookupDestinationId(array(2)));
     $rid = 'migrate_test_role_1';
     $migrate_test_role_1 = Role::load($rid);
     $this->assertIdentical($rid, $migrate_test_role_1->id());
     $this->assertIdentical(array('migrate test role 1 test permission', 'use text format full_html', 'use text format php_code'), $migrate_test_role_1->getPermissions());
     $this->assertIdentical(array($rid), $id_map->lookupDestinationId(array(3)));
     $rid = 'migrate_test_role_2';
     $migrate_test_role_2 = Role::load($rid);
     $this->assertIdentical(array('migrate test role 2 test permission', 'use PHP for settings', 'administer contact forms', 'skip comment approval', 'edit own blog content', 'edit any blog content', 'delete own blog content', 'delete any blog content', 'create forum content', 'delete any forum content', 'delete own forum content', 'edit any forum content', 'edit own forum content', 'administer nodes', 'access content overview', 'use text format php_code'), $migrate_test_role_2->getPermissions());
     $this->assertIdentical($rid, $migrate_test_role_2->id());
     $this->assertIdentical(array($rid), $id_map->lookupDestinationId(array(4)));
     $rid = 'migrate_test_role_3_that_is_long';
     $migrate_test_role_3 = Role::load($rid);
     $this->assertIdentical($rid, $migrate_test_role_3->id());
     $this->assertIdentical(array($rid), $id_map->lookupDestinationId(array(5)));
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:32,代码来源:MigrateUserRoleTest.php


示例12: buildMigrations

 /**
  * {@inheritdoc}
  */
 public function buildMigrations(array $template)
 {
     $migrations = [];
     // Read all CCK field instance definitions in the source database.
     $fields = array();
     foreach ($this->getSourcePlugin('d6_field_instance', $template['source']) as $field) {
         $info = $field->getSource();
         $fields[$info['type_name']][$info['field_name']] = $info;
     }
     foreach ($this->getSourcePlugin('d6_node_type', $template['source']) as $row) {
         $node_type = $row->getSourceProperty('type');
         $values = $template;
         $values['id'] = $template['id'] . '__' . $node_type;
         $label = $template['label'];
         $values['label'] = $this->t("@label (@type)", ['@label' => $label, '@type' => $node_type]);
         $values['source']['node_type'] = $node_type;
         $migration = Migration::create($values);
         if (isset($fields[$node_type])) {
             foreach ($fields[$node_type] as $field => $info) {
                 if ($this->cckPluginManager->hasDefinition($info['type'])) {
                     $this->getCckPlugin($info['type'])->processCckFieldValues($migration, $field, $info);
                 } else {
                     $migration->setProcessOfProperty($field, $field);
                 }
             }
         }
         $migrations[] = $migration;
     }
     return $migrations;
 }
开发者ID:komejo,项目名称:article-test,代码行数:33,代码来源:Node.php


示例13: 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);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:28,代码来源:MigrateUploadTest.php


示例14: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $id_mappings = array('d6_node:*' => array(array(array(0), array(0))));
     $this->prepareMigrations($id_mappings);
     $migrations = Migration::loadMultiple(['d6_term_node:*']);
     array_walk($migrations, [$this, 'executeMigration']);
 }
开发者ID:ravindrasingh22,项目名称:Drupal-8-rc,代码行数:11,代码来源:MigrateTermNodeTest.php


示例15: testVocabularyEntityFormDisplay

 /**
  * Tests the Drupal 6 vocabulary-node type association to Drupal 8 migration.
  */
 public function testVocabularyEntityFormDisplay()
 {
     // Test that the field exists.
     $component = EntityFormDisplay::load('node.page.default')->getComponent('tags');
     $this->assertIdentical('options_select', $component['type']);
     $this->assertIdentical(20, $component['weight']);
     // Test the Id map.
     $this->assertIdentical(array('node', 'article', 'default', 'tags'), Migration::load('d6_vocabulary_entity_form_display')->getIdMap()->lookupDestinationID(array(4, 'article')));
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:12,代码来源:MigrateVocabularyEntityFormDisplayTest.php


示例16: testViewModes

 /**
  * Tests Drupal 6 view modes to Drupal 8 migration.
  */
 public function testViewModes()
 {
     // Test a new view mode.
     $view_mode = EntityViewMode::load('node.preview');
     $this->assertIdentical(FALSE, is_null($view_mode), 'Preview view mode loaded.');
     $this->assertIdentical('Preview', $view_mode->label(), 'View mode has correct label.');
     // Test the ID map.
     $this->assertIdentical(array('node', 'preview'), Migration::load('d6_view_modes')->getIdMap()->lookupDestinationID(array(1)));
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:12,代码来源:MigrateViewModesTest.php


示例17: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->installConfig(['system']);
     // A simple migration, which will generate a message to the id map because
     // the concat plugin throws an exception if its source is not an array.
     $config = ['id' => 'sample_data', 'migration_tags' => ['Message test'], 'source' => ['plugin' => 'embedded_data', 'data_rows' => [['name' => 'source_message', 'value' => 'a message']], 'ids' => ['name' => ['type' => 'string']]], 'process' => ['message' => ['plugin' => 'concat', 'source' => 'value']], 'destination' => ['plugin' => 'config', 'config_name' => 'system.maintenance']];
     $this->migration = Migration::create($config);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:12,代码来源:MigrateMessageTest.php


示例18: createStub

 /**
  * Create a stub of the given entity type.
  *
  * @param string $entity_type_id
  *   The entity type we are stubbing.
  *
  * @return int
  *   ID of the created entity.
  */
 protected function createStub($entity_type_id)
 {
     // Create a dummy migration to pass to the destination plugin.
     $config = ['id' => 'dummy', 'migration_tags' => ['Stub test'], 'source' => ['plugin' => 'empty'], 'process' => [], 'destination' => ['plugin' => 'entity:' . $entity_type_id]];
     $migration = Migration::create($config);
     $destination_plugin = $migration->getDestinationPlugin(TRUE);
     $stub_row = new Row([], [], TRUE);
     $destination_ids = $destination_plugin->import($stub_row);
     return reset($destination_ids);
 }
开发者ID:sarahwillem,项目名称:OD8,代码行数:19,代码来源:StubTestTrait.php


示例19: testAggregatorMigrateDependencies

 /**
  * Tests dependencies on the migration of aggregator feeds & items.
  */
 public function testAggregatorMigrateDependencies()
 {
     /** @var \Drupal\migrate\entity\Migration $migration */
     $migration = Migration::load('d6_aggregator_item');
     $executable = new MigrateExecutable($migration, $this);
     $this->startCollectingMessages();
     $executable->import();
     $this->assertEqual($this->migrateMessages['error'], array(SafeMarkup::format('Migration @id did not meet the requirements. Missing migrations d6_aggregator_feed. requirements: d6_aggregator_feed.', array('@id' => $migration->id()))));
     $this->collectMessages = FALSE;
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:13,代码来源:MigrateDependenciesTest.php


示例20: testMissingTable

 /**
  * Tests that an exception is thrown when ImageCache is not installed.
  */
 public function testMissingTable()
 {
     $this->sourceDatabase->update('system')->fields(array('status' => 0))->condition('name', 'imagecache')->condition('type', 'module')->execute();
     try {
         Migration::load('d6_imagecache_presets')->getSourcePlugin()->checkRequirements();
         $this->fail('Did not catch expected RequirementsException.');
     } catch (RequirementsException $e) {
         $this->pass('Caught expected RequirementsException: ' . $e->getMessage());
     }
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:13,代码来源:MigrateImageCacheTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP source\DrupalSqlBase类代码示例发布时间:2022-05-23
下一篇:
PHP migrate\Row类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap