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


PHP entity_load函数代码示例

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


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

示例1: testFilterUI

 /**
  * Tests the filter UI.
  */
 public function testFilterUI()
 {
     $this->drupalGet('admin/structure/views/nojs/handler/test_filter_taxonomy_index_tid/default/filter/tid');
     $result = $this->xpath('//select[@id="edit-options-value"]/option');
     // Ensure that the expected hierarchy is available in the UI.
     $counter = 0;
     for ($i = 0; $i < 3; $i++) {
         for ($j = 0; $j <= $i; $j++) {
             $option = $result[$counter++];
             $prefix = $this->terms[$i][$j]->parent->target_id ? '-' : '';
             $attributes = $option->attributes();
             $tid = (string) $attributes->value;
             $this->assertEqual($prefix . $this->terms[$i][$j]->getName(), (string) $option);
             $this->assertEqual($this->terms[$i][$j]->id(), $tid);
         }
     }
     // Ensure the autocomplete input element appears when using the 'textfield'
     // type.
     $view = entity_load('view', 'test_filter_taxonomy_index_tid');
     $display =& $view->getDisplay('default');
     $display['display_options']['filters']['tid']['type'] = 'textfield';
     $view->save();
     $this->drupalGet('admin/structure/views/nojs/handler/test_filter_taxonomy_index_tid/default/filter/tid');
     $this->assertFieldByXPath('//input[@id="edit-options-value"]');
     // Tests \Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid::calculateDependencies().
     $expected = ['config' => ['taxonomy.vocabulary.tags'], 'content' => ['taxonomy_term:tags:' . Term::load(2)->uuid()], 'module' => ['node', 'taxonomy', 'user']];
     $this->assertIdentical($expected, $view->calculateDependencies());
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:31,代码来源:TaxonomyIndexTidUiTest.php

示例2: testNodeCreation

 /**
  * Creates a "Basic page" node and verifies its consistency in the database.
  */
 function testNodeCreation()
 {
     // Test /node/add page with only one content type.
     entity_load('node_type', 'article')->delete();
     $this->drupalGet('node/add');
     $this->assertResponse(200);
     $this->assertUrl('node/add/page');
     // Create a node.
     $edit = array();
     $edit['title[0][value]'] = $this->randomMachineName(8);
     $edit['body[0][value]'] = $this->randomMachineName(16);
     $this->drupalPostForm('node/add/page', $edit, t('Save'));
     // Check that the Basic page has been created.
     $this->assertRaw(t('!post %title has been created.', array('!post' => 'Basic page', '%title' => $edit['title[0][value]'])), 'Basic page created.');
     // Check that the node exists in the database.
     $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
     $this->assertTrue($node, 'Node found in database.');
     // Verify that pages do not show submitted information by default.
     $this->drupalGet('node/' . $node->id());
     $this->assertNoText($node->getOwner()->getUsername());
     $this->assertNoText(format_date($node->getCreatedTime()));
     // Change the node type setting to show submitted by information.
     $node_type = entity_load('node_type', 'page');
     $node_type->setDisplaySubmitted(TRUE);
     $node_type->save();
     $this->drupalGet('node/' . $node->id());
     $this->assertText($node->getOwner()->getUsername());
     $this->assertText(format_date($node->getCreatedTime()));
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:32,代码来源:NodeCreationTest.php

示例3: testLoadingEntitiesCreatedInBatch

 /**
  * Tests loading entities created in a batch in simpletest_test_install().
  */
 public function testLoadingEntitiesCreatedInBatch()
 {
     $entity1 = entity_load('entity_test', 1);
     $this->assertNotNull($entity1, 'Successfully loaded entity 1.');
     $entity2 = entity_load('entity_test', 2);
     $this->assertNotNull($entity2, 'Successfully loaded entity 2.');
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:10,代码来源:SimpleTestInstallBatchTest.php

示例4: testTaxonomyTermHierarchy

 /**
  * Test terms in a single and multiple hierarchy.
  */
 function testTaxonomyTermHierarchy()
 {
     // Create two taxonomy terms.
     $term1 = $this->createTerm($this->vocabulary);
     $term2 = $this->createTerm($this->vocabulary);
     // Check that hierarchy is flat.
     $vocabulary = entity_load('taxonomy_vocabulary', $this->vocabulary->id());
     $this->assertEqual(0, $vocabulary->hierarchy, 'Vocabulary is flat.');
     // Edit $term2, setting $term1 as parent.
     $edit = array();
     $edit['parent[]'] = array($term1->id());
     $this->drupalPostForm('taxonomy/term/' . $term2->id() . '/edit', $edit, t('Save'));
     // Check the hierarchy.
     $children = taxonomy_term_load_children($term1->id());
     $parents = taxonomy_term_load_parents($term2->id());
     $this->assertTrue(isset($children[$term2->id()]), 'Child found correctly.');
     $this->assertTrue(isset($parents[$term1->id()]), 'Parent found correctly.');
     // Load and save a term, confirming that parents are still set.
     $term = Term::load($term2->id());
     $term->save();
     $parents = taxonomy_term_load_parents($term2->id());
     $this->assertTrue(isset($parents[$term1->id()]), 'Parent found correctly.');
     // Create a third term and save this as a parent of term2.
     $term3 = $this->createTerm($this->vocabulary);
     $term2->parent = array($term1->id(), $term3->id());
     $term2->save();
     $parents = taxonomy_term_load_parents($term2->id());
     $this->assertTrue(isset($parents[$term1->id()]) && isset($parents[$term3->id()]), 'Both parents found successfully.');
 }
开发者ID:anyforsoft,项目名称:csua_d8,代码行数:32,代码来源:TermTest.php

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

示例6: testCacheTags

 /**
  * Tests the bubbling of cache tags.
  */
 public function testCacheTags()
 {
     // Create the entity that will be commented upon.
     $commented_entity = entity_create('entity_test', array('name' => $this->randomMachineName()));
     $commented_entity->save();
     // Verify cache tags on the rendered entity before it has comments.
     $build = \Drupal::entityManager()->getViewBuilder('entity_test')->view($commented_entity);
     drupal_render($build);
     $expected_cache_tags = array('entity_test_view', 'entity_test:' . $commented_entity->id(), 'comment_list');
     sort($expected_cache_tags);
     $this->assertEqual($build['#cache']['tags'], $expected_cache_tags, 'The test entity has the expected cache tags before it has comments.');
     // Create a comment on that entity. Comment loading requires that the uid
     // also exists in the {users} table.
     $user = $this->createUser();
     $user->save();
     $comment = entity_create('comment', array('subject' => 'Llama', 'comment_body' => array('value' => 'Llamas are cool!', 'format' => 'plain_text'), 'entity_id' => $commented_entity->id(), 'entity_type' => 'entity_test', 'field_name' => 'comment', 'comment_type' => 'comment', 'status' => CommentInterface::PUBLISHED, 'uid' => $user->id()));
     $comment->save();
     // Load commented entity so comment_count gets computed.
     // @todo Remove the $reset = TRUE parameter after
     //   https://www.drupal.org/node/597236 lands. It's a temporary work-around.
     $commented_entity = entity_load('entity_test', $commented_entity->id(), TRUE);
     // Verify cache tags on the rendered entity when it has comments.
     $build = \Drupal::entityManager()->getViewBuilder('entity_test')->view($commented_entity);
     drupal_render($build);
     $expected_cache_tags = array('entity_test_view', 'entity_test:' . $commented_entity->id(), 'comment_list', 'comment_view', 'comment:' . $comment->id(), 'config:filter.format.plain_text', 'user_view', 'user:2');
     sort($expected_cache_tags);
     $this->assertEqual($build['#cache']['tags'], $expected_cache_tags, 'The test entity has the expected cache tags when it has comments.');
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:31,代码来源:CommentDefaultFormatterCacheTagsTest.php

示例7: testTestItem

 /**
  * Tests using entity fields of the field field type.
  */
 public function testTestItem()
 {
     // Verify entity creation.
     $entity = EntityTest::create();
     $value = rand(1, 10);
     $entity->field_test = $value;
     $entity->name->value = $this->randomMachineName();
     $entity->save();
     // Verify entity has been created properly.
     $id = $entity->id();
     $entity = entity_load('entity_test', $id);
     $this->assertTrue($entity->{$this->fieldName} instanceof FieldItemListInterface, 'Field implements interface.');
     $this->assertTrue($entity->{$this->fieldName}[0] instanceof FieldItemInterface, 'Field item implements interface.');
     $this->assertEqual($entity->{$this->fieldName}->value, $value);
     $this->assertEqual($entity->{$this->fieldName}[0]->value, $value);
     // Verify changing the field value.
     $new_value = rand(1, 10);
     $entity->field_test->value = $new_value;
     $this->assertEqual($entity->{$this->fieldName}->value, $new_value);
     // Read changed entity and assert changed values.
     $entity->save();
     $entity = entity_load('entity_test', $id);
     $this->assertEqual($entity->{$this->fieldName}->value, $new_value);
     // Test the schema for this field type.
     $expected_schema = array('columns' => array('value' => array('type' => 'int', 'size' => 'medium')), 'unique keys' => array(), 'indexes' => array('value' => array('value')), 'foreign keys' => array());
     $field_schema = BaseFieldDefinition::create('test_field')->getSchema();
     $this->assertEqual($field_schema, $expected_schema);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:31,代码来源:TestItemTest.php

示例8: testRecreateEntity

 public function testRecreateEntity()
 {
     $type_name = Unicode::strtolower($this->randomMachineName(16));
     $content_type = entity_create('node_type', array('type' => $type_name, 'name' => 'Node type one'));
     $content_type->save();
     /** @var \Drupal\Core\Config\StorageInterface $active */
     $active = $this->container->get('config.storage');
     /** @var \Drupal\Core\Config\StorageInterface $staging */
     $staging = $this->container->get('config.storage.staging');
     $config_name = $content_type->getEntityType()->getConfigPrefix() . '.' . $content_type->id();
     $this->copyConfig($active, $staging);
     // Delete the content type. This will also delete a field storage, a field,
     // an entity view display and an entity form display.
     $content_type->delete();
     $this->assertFalse($active->exists($config_name), 'Content type\'s old name does not exist active store.');
     // Recreate with the same type - this will have a different UUID.
     $content_type = entity_create('node_type', array('type' => $type_name, 'name' => 'Node type two'));
     $content_type->save();
     $this->configImporter->reset();
     // A node type, a field storage, a field, an entity view display and an
     // entity form display will be recreated.
     $creates = $this->configImporter->getUnprocessedConfiguration('create');
     $deletes = $this->configImporter->getUnprocessedConfiguration('delete');
     $this->assertEqual(5, count($creates), 'There are 5 configuration items to create.');
     $this->assertEqual(5, count($deletes), 'There are 5 configuration items to delete.');
     $this->assertEqual(0, count($this->configImporter->getUnprocessedConfiguration('update')), 'There are no configuration items to update.');
     $this->assertIdentical($creates, array_reverse($deletes), 'Deletes and creates contain the same configuration names in opposite orders due to dependencies.');
     $this->configImporter->import();
     // Verify that there is nothing more to import.
     $this->assertFalse($this->configImporter->reset()->hasUnprocessedConfigurationChanges());
     $content_type = entity_load('node_type', $type_name);
     $this->assertEqual('Node type one', $content_type->label());
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:33,代码来源:ConfigImportRecreateTest.php

示例9: testShapeItem

 /**
  * Tests using entity fields of the field field type.
  */
 public function testShapeItem()
 {
     // Verify entity creation.
     $entity = EntityTest::create();
     $shape = 'cube';
     $color = 'blue';
     $entity->{$this->fieldName}->shape = $shape;
     $entity->{$this->fieldName}->color = $color;
     $entity->name->value = $this->randomMachineName();
     $entity->save();
     // Verify entity has been created properly.
     $id = $entity->id();
     $entity = entity_load('entity_test', $id);
     $this->assertTrue($entity->{$this->fieldName} instanceof FieldItemListInterface, 'Field implements interface.');
     $this->assertTrue($entity->{$this->fieldName}[0] instanceof FieldItemInterface, 'Field item implements interface.');
     $this->assertEqual($entity->{$this->fieldName}->shape, $shape);
     $this->assertEqual($entity->{$this->fieldName}->color, $color);
     $this->assertEqual($entity->{$this->fieldName}[0]->shape, $shape);
     $this->assertEqual($entity->{$this->fieldName}[0]->color, $color);
     // Verify changing the field value.
     $new_shape = 'circle';
     $new_color = 'red';
     $entity->{$this->fieldName}->shape = $new_shape;
     $entity->{$this->fieldName}->color = $new_color;
     $this->assertEqual($entity->{$this->fieldName}->shape, $new_shape);
     $this->assertEqual($entity->{$this->fieldName}->color, $new_color);
     // Read changed entity and assert changed values.
     $entity->save();
     $entity = entity_load('entity_test', $id);
     $this->assertEqual($entity->{$this->fieldName}->shape, $new_shape);
     $this->assertEqual($entity->{$this->fieldName}->color, $new_color);
 }
开发者ID:sojo,项目名称:d8_friendsofsilence,代码行数:35,代码来源:ShapeItemTest.php

示例10: processCallback

 /**
  * Callback for preg_replace in process()
  */
 public static function processCallback($matches = array())
 {
     $content = '';
     $entity_type = $entity_id = $view_mode = '';
     foreach ($matches as $key => $match) {
         switch ($key) {
             case 1:
                 $entity_type = $match;
                 break;
             case 2:
                 $entity_id = $match;
                 break;
             case 3:
                 $view_mode = $match;
                 break;
         }
     }
     $entities = entity_load($entity_type, array($entity_id));
     if (!empty($entities)) {
         $render_array = entity_view($entity_type, $entities, $view_mode, NULL, TRUE);
         // Remove contextual links.
         if (isset($render_array[$entity_type][$entity_id]['#contextual_links'])) {
             unset($render_array[$entity_type][$entity_id]['#contextual_links']);
         }
         $content = render($render_array);
     }
     return $content;
 }
开发者ID:rafavergara,项目名称:ddv8,代码行数:31,代码来源:FilterMailchimpCampaign.php

示例11: testUserRole

 /**
  * Tests user role migration.
  */
 public function testUserRole()
 {
     /** @var \Drupal\migrate\entity\Migration $migration */
     $migration = entity_load('migration', 'd6_user_role');
     $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), $migration->getIdMap()->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), $migration->getIdMap()->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(0 => 'migrate test role 1 test permission', 'use text format full_html'), $migrate_test_role_1->getPermissions());
     $this->assertIdentical(array($rid), $migration->getIdMap()->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'), $migrate_test_role_2->getPermissions());
     $this->assertIdentical($rid, $migrate_test_role_2->id());
     $this->assertIdentical(array($rid), $migration->getIdMap()->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), $migration->getIdMap()->lookupDestinationId(array(5)));
 }
开发者ID:ravindrasingh22,项目名称:Drupal-8-rc,代码行数:32,代码来源:MigrateUserRoleTest.php

示例12: testCrudAndUpdate

 /**
  * Tests processed properties.
  */
 public function testCrudAndUpdate()
 {
     $entity_type = 'entity_test';
     $this->createField($entity_type);
     // Create an entity with a summary and no text format.
     $entity = entity_create($entity_type);
     $entity->summary_field->value = $value = $this->randomMachineName();
     $entity->summary_field->summary = $summary = $this->randomMachineName();
     $entity->summary_field->format = NULL;
     $entity->name->value = $this->randomMachineName();
     $entity->save();
     $entity = entity_load($entity_type, $entity->id());
     $this->assertTrue($entity->summary_field instanceof FieldItemListInterface, 'Field implements interface.');
     $this->assertTrue($entity->summary_field[0] instanceof FieldItemInterface, 'Field item implements interface.');
     $this->assertEqual($entity->summary_field->value, $value);
     $this->assertEqual($entity->summary_field->summary, $summary);
     $this->assertNull($entity->summary_field->format);
     // Even if no format is given, if text processing is enabled, the default
     // format is used.
     $this->assertEqual($entity->summary_field->processed, "<p>{$value}</p>\n");
     $this->assertEqual($entity->summary_field->summary_processed, "<p>{$summary}</p>\n");
     // Change the format, this should update the processed properties.
     $entity->summary_field->format = 'no_filters';
     $this->assertEqual($entity->summary_field->processed, $value);
     $this->assertEqual($entity->summary_field->summary_processed, $summary);
     // Test the generateSampleValue() method.
     $entity = entity_create($entity_type);
     $entity->summary_field->generateSampleItems();
     $this->entityValidateAndSave($entity);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:33,代码来源:TextWithSummaryItemTest.php

示例13: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     if ($this->profile != 'standard') {
         $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page', 'settings' => array('node' => array('options' => array('promote' => FALSE), 'submitted' => FALSE))));
         $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
     }
     $this->admin_user = $this->drupalCreateUser(array('administer nodes', 'bypass node access', 'administer content types', 'administer xmlsitemap', 'administer taxonomy'));
     $this->normal_user = $this->drupalCreateUser(array('create page content', 'edit any page content', 'access content', 'view own unpublished content'));
     // allow anonymous user to view user profiles
     $user_role = entity_load('user_role', DRUPAL_ANONYMOUS_RID);
     $user_role->grantPermission('access content');
     $user_role->save();
     xmlsitemap_link_bundle_enable('node', 'article');
     xmlsitemap_link_bundle_enable('node', 'page');
     $this->config->set('xmlsitemap_entity_taxonomy_vocabulary', 1);
     $this->config->set('xmlsitemap_entity_taxonomy_term', 1);
     $this->config->save();
     xmlsitemap_link_bundle_settings_save('node', 'page', array('status' => 1, 'priority' => 0.6, 'changefreq' => XMLSITEMAP_FREQUENCY_WEEKLY));
     // Add a vocabulary so we can test different view modes.
     $vocabulary = entity_create('taxonomy_vocabulary', array('name' => 'Tags', 'description' => $this->randomMachineName(), 'vid' => 'tags', 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'help' => ''));
     $vocabulary->save();
     xmlsitemap_link_bundle_enable('taxonomy_term', 'tags');
     // Set up a field and instance.
     $field_name = 'tags';
     entity_create('field_storage_config', array('name' => $field_name, 'entity_type' => 'node', 'type' => 'taxonomy_term_reference', 'settings' => array('allowed_values' => array(array('vocabulary' => $vocabulary->vid, 'parent' => '0'))), 'cardinality' => '-1'))->save();
     entity_create('field_instance_config', array('field_name' => $field_name, 'entity_type' => 'node', 'bundle' => 'page'))->save();
     entity_get_form_display('node', 'page', 'default')->setComponent($field_name, array('type' => 'taxonomy_autocomplete'))->save();
     // Show on default display and teaser.
     entity_get_display('node', 'page', 'default')->setComponent($field_name, array('type' => 'taxonomy_term_reference_link'))->save();
     entity_get_display('node', 'page', 'teaser')->setComponent($field_name, array('type' => 'taxonomy_term_reference_link'))->save();
 }
开发者ID:jeroenos,项目名称:jeroenos_d8.mypressonline.com,代码行数:35,代码来源:XmlSitemapNodeFunctionalTest.php

示例14: 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();
 }
开发者ID:ravindrasingh22,项目名称:Drupal-8-rc,代码行数:32,代码来源:MigrateNodeTestBase.php

示例15: testFactoryService

 /**
  * Tests the views.executable container service.
  */
 public function testFactoryService()
 {
     $factory = $this->container->get('views.executable');
     $this->assertTrue($factory instanceof ViewExecutableFactory, 'A ViewExecutableFactory instance was returned from the container.');
     $view = entity_load('view', 'test_executable_displays');
     $this->assertTrue($factory->get($view) instanceof ViewExecutable, 'A ViewExecutable instance was returned from the factory.');
 }
开发者ID:papillon-cendre,项目名称:d8,代码行数:10,代码来源:ViewExecutableTest.php


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