Пример #1
0
 /**
  * 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());
 }
 /**
  * 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()));
 }
Пример #3
0
 /**
  * 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.');
 }
Пример #4
0
 /**
  * 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.');
 }
Пример #5
0
 /**
  * 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());
 }
 /**
  * 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.');
 }
Пример #7
0
 /**
  * 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);
 }
 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());
 }
Пример #9
0
 /**
  * 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);
 }
Пример #10
0
 /**
  * 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;
 }
 /**
  * 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)));
 }
Пример #12
0
 /**
  * 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);
 }
 /**
  * {@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();
 }
 /**
  * {@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();
 }
Пример #15
0
 /**
  * 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.');
 }
 /**
  * {@inheritdoc}
  */
 public function viewElements(FieldItemListInterface $items, $langcode)
 {
     $elements = array();
     $files = $this->getEntitiesToView($items, $langcode);
     // Early opt-out if the field is empty.
     if (empty($files)) {
         return $elements;
     }
     $image_style_setting = $this->getSetting('image_style');
     // Determine if Image style is required.
     $image_style = NULL;
     if (!empty($image_style_setting)) {
         $image_style = entity_load('image_style', $image_style_setting);
     }
     foreach ($files as $delta => $file) {
         $image_uri = $file->getFileUri();
         // Get image style URL
         if ($image_style) {
             $image_uri = ImageStyle::load($image_style->getName())->buildUrl($image_uri);
         } else {
             // Get absolute path for original image
             $image_uri = $file->url();
         }
         $elements[$delta] = array('#markup' => $image_uri);
     }
     return $elements;
 }
Пример #17
0
 public function testMenuLinks()
 {
     $menu_link = entity_load('menu_link_content', 138);
     $this->assertIdentical('Test 1', $menu_link->getTitle());
     $this->assertIdentical('secondary-links', $menu_link->getMenuName());
     $this->assertIdentical('Test menu link 1', $menu_link->getDescription());
     $this->assertIdentical(TRUE, $menu_link->isEnabled());
     $this->assertIdentical(FALSE, $menu_link->isExpanded());
     $this->assertIdentical(['attributes' => ['title' => 'Test menu link 1']], $menu_link->link->options);
     $this->assertIdentical('internal:/user/login', $menu_link->link->uri);
     $this->assertIdentical(15, $menu_link->getWeight());
     $menu_link = entity_load('menu_link_content', 139);
     $this->assertIdentical('Test 2', $menu_link->getTitle());
     $this->assertIdentical('secondary-links', $menu_link->getMenuName());
     $this->assertIdentical('Test menu link 2', $menu_link->getDescription());
     $this->assertIdentical(TRUE, $menu_link->isEnabled());
     $this->assertIdentical(TRUE, $menu_link->isExpanded());
     $this->assertIdentical(['query' => 'foo=bar', 'attributes' => ['title' => 'Test menu link 2']], $menu_link->link->options);
     $this->assertIdentical('internal:/admin', $menu_link->link->uri);
     $this->assertIdentical(12, $menu_link->getWeight());
     $menu_link = entity_load('menu_link_content', 140);
     $this->assertIdentical('Drupal.org', $menu_link->getTitle());
     $this->assertIdentical('secondary-links', $menu_link->getMenuName());
     $this->assertIdentical('', $menu_link->getDescription());
     $this->assertIdentical(TRUE, $menu_link->isEnabled());
     $this->assertIdentical(FALSE, $menu_link->isExpanded());
     $this->assertIdentical(['attributes' => ['title' => '']], $menu_link->link->options);
     $this->assertIdentical('https://www.drupal.org', $menu_link->link->uri);
     $this->assertIdentical(0, $menu_link->getWeight());
 }
 /**
  * {@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();
 }
 protected function setUp()
 {
     parent::setUp();
     node_access_test_add_field(entity_load('node_type', 'article'));
     node_access_rebuild();
     \Drupal::state()->set('node_access_test.private', TRUE);
 }
Пример #20
0
 /**
  * Tests using entity fields of the geolocation field type.
  */
 public function testTestItem()
 {
     // Verify entity creation.
     $entity = entity_create('entity_test');
     $entity->name->value = $this->randomMachineName();
     $lat = '49.880657';
     $lng = '10.869212';
     $entity->field_test->lat = $lat;
     $entity->field_test->lng = $lng;
     $entity->save();
     // Verify entity has been created properly.
     $id = $entity->id();
     $entity = entity_load('entity_test', $id);
     $this->assertTrue($entity->field_test instanceof FieldItemListInterface, 'Field implements interface.');
     $this->assertTrue($entity->field_test[0] instanceof FieldItemInterface, 'Field item implements interface.');
     $this->assertEqual($entity->field_test->lat, $lat, "Lat {$entity->field_test->lat} is equal to lat {$lat}.");
     $this->assertEqual($entity->field_test[0]->lat, $lat, "Lat {$entity->field_test[0]->lat} is equal to lat {$lat}.");
     $this->assertEqual($entity->field_test->lng, $lng, "Lng {$entity->field_test->lng} is equal to lng {$lng}.");
     $this->assertEqual($entity->field_test[0]->lng, $lng, "Lng {$entity->field_test[0]->lng} is equal to lng {$lng}.");
     // Verify changing the field value.
     $new_lat = rand(-90, 90) - rand(0, 999999) / 1000000;
     $new_lng = rand(-180, 180) - rand(0, 999999) / 1000000;
     $entity->field_test->lat = $new_lat;
     $entity->field_test->lng = $new_lng;
     $this->assertEqual($entity->field_test->lat, $new_lat, "Lat {$entity->field_test->lat} is equal to new lat {$new_lat}.");
     $this->assertEqual($entity->field_test->lng, $new_lng, "Lng {$entity->field_test->lng} is equal to new lng {$new_lng}.");
     // Read changed entity and assert changed values.
     $entity->save();
     $entity = entity_load('entity_test', $id);
     $this->assertEqual($entity->field_test->lat, $new_lat, "Lat {$entity->field_test->lat} is equal to new lat {$new_lat}.");
     $this->assertEqual($entity->field_test->lng, $new_lng, "Lng {$entity->field_test->lng} is equal to new lng {$new_lng}.");
 }
 /**
  * Test Currency's UI.
  */
 function testUI()
 {
     $user = $this->drupalCreateUser(array('currency.currency.view', 'currency.currency.create', 'currency.currency.update', 'currency.currency.delete'));
     $this->drupalLogin($user);
     $path = 'admin/config/regional/currency/add';
     // Test valid values.
     $valid_values = array('currency_code' => 'ABC', 'currency_number' => '123', 'label' => 'foo', 'rounding_step' => '1', 'sign[sign]' => CurrencySign::CUSTOM_VALUE, 'sign[sign_custom]' => 'foobar', 'subunits' => 2, 'status' => FALSE);
     $this->drupalPostForm($path, $valid_values, t('Save'));
     /** @var \Drupal\currency\Entity\CurrencyInterface $currency */
     $currency = entity_load('currency', 'ABC');
     if ($this->assertTrue($currency)) {
         $this->assertFalse($currency->status());
     }
     // Test invalid values.
     $valid_values['currency_code'] = 'XYZ';
     $valid_values['currency_number'] = '000';
     $invalid_values = array('currency_code' => array('ABC', 'EUR'), 'currency_number' => array('abc', '978'), 'rounding_step' => array('x'), 'subunits' => array('x'));
     foreach ($invalid_values as $name => $field_invalid_values) {
         foreach ($field_invalid_values as $invalid_value) {
             $values = array($name => $invalid_value) + $valid_values;
             $this->drupalPostForm($path, $values, t('Save'));
             // Test that the invalid element is the only element to be flagged.
             $this->assertFieldByXPath("//input[@name='{$name}' and contains(@class, 'error')]");
             $this->assertNoFieldByXPath("//input[not(@name='{$name}') and contains(@class, 'error')]");
         }
     }
     // Edit and save an existing currency.
     $path = 'admin/config/regional/currency/ABC';
     $this->drupalPostForm($path, array(), t('Save'));
     $this->assertUrl('admin/config/regional/currency');
 }
Пример #22
0
 /**
  * Test a gallery embedded in a view row that is dependent on the Juicebox
  * cache.
  */
 public function testSubRequestDependent()
 {
     $node = $this->node;
     $xml_path = 'juicebox/xml/field/node/' . $node->id() . '/' . $this->instFieldName . '/_custom';
     $xml_url = \Drupal::url('juicebox.xml_field', array('entityType' => 'node', 'entityId' => $node->id(), 'fieldName' => $this->instFieldName, 'displayName' => '_custom'));
     // Get the urls to the test image and thumb derivative used by default.
     $uri = \Drupal\file\Entity\File::load($node->{$this->instFieldName}[0]->target_id)->getFileUri();
     $test_image_url = entity_load('image_style', 'juicebox_medium')->buildUrl($uri);
     $test_thumb_url = entity_load('image_style', 'juicebox_square_thumb')->buildUrl($uri);
     // Check for correct embed markup. This will also prime the cache.
     $content = $this->drupalGet('juicebox_test_row_formatter');
     $this->assertRaw(trim(json_encode(array('configUrl' => $xml_url)), '{}"'), 'Gallery setting found in Drupal.settings.');
     $this->assertRaw('id="node--' . $node->id() . '--' . str_replace('_', '-', $this->instFieldName) . '---custom"', 'Embed code wrapper found.');
     $this->assertRaw(Html::escape($test_image_url), 'Test image found in embed code');
     // Extract the xml-source values from the XML.
     $matches = array();
     // In the pattern below we have to use four (yeah, FOUR) backslashes to
     // match a SINGLE literal backslash. Our source will contain an encoded
     // (JSON) "&" character as "\u0026", but we don't want the regex to confuse
     // that with an actaul "&" char in the pattern itself.
     preg_match('|xml-source-path=([a-z1-9_-]+)\\\\u0026xml-source-id=([a-z1-9-]+)|', $content, $matches);
     $this->assertNotNull($matches[1], 'xml-source-path value found in Drupal.settings.');
     $this->assertNotNull($matches[2], 'xml-source-id value found in Drupal.settings.');
     // Check for correct XML. This example is dependent on a sub-request XML
     // lookup, so everything below would fail without that feature.
     $this->drupalGet($xml_path, array('query' => array('xml-source-path' => $matches[1], 'xml-source-id' => $matches[2])));
     $this->assertRaw('<?xml version="1.0" encoding="UTF-8"?>', 'Valid XML detected.');
     $this->assertRaw('imageURL="' . Html::escape($test_image_url), 'Test image found in XML.' . $test_image_url);
     $this->assertRaw('thumbURL="' . Html::escape($test_thumb_url), 'Test thumbnail found in XML.' . $test_thumb_url);
     $this->assertRaw('backgroundcolor="green"', 'Custom background setting from pseudo field instance config found in XML.');
 }
Пример #23
0
 /**
  * Returns the in-place editor that Quick Edit selects.
  */
 protected function getSelectedEditor($entity_id, $field_name, $view_mode = 'default')
 {
     $entity = entity_load('entity_test', $entity_id, TRUE);
     $items = $entity->get($field_name);
     $options = entity_get_display('entity_test', 'entity_test', $view_mode)->getComponent($field_name);
     return $this->editorSelector->getEditor($options['type'], $items);
 }
Пример #24
0
 /**
  * Tests the node bulk form.
  */
 public function testBulkForm()
 {
     $this->drupalLogin($this->drupalCreateUser(array('administer nodes')));
     $node = $this->drupalCreateNode();
     $this->drupalGet('test-node-bulk-form');
     $elements = $this->xpath('//select[@id="edit-action"]//option');
     $this->assertIdentical(count($elements), 8, 'All node operations are found.');
     // Unpublish a node using the bulk form.
     $this->assertTrue($node->isPublished(), 'Node is initially published');
     $edit = array('node_bulk_form[0]' => TRUE, 'action' => 'node_unpublish_action');
     $this->drupalPostForm(NULL, $edit, t('Apply'));
     // Re-load the node and check the status.
     $node = entity_load('node', $node->id(), TRUE);
     $this->assertFalse($node->isPublished(), 'Node has been unpublished');
     // Publish action.
     $edit = array('node_bulk_form[0]' => TRUE, 'action' => 'node_publish_action');
     $this->drupalPostForm(NULL, $edit, t('Apply'));
     // Re-load the node and check the status.
     $node = entity_load('node', $node->id(), TRUE);
     $this->assertTrue($node->isPublished(), 'Node has been published');
     // Make sticky action.
     $node->setPublished(FALSE);
     $node->save();
     $this->assertFalse($node->isSticky(), 'Node is not sticky');
     $edit = array('node_bulk_form[0]' => TRUE, 'action' => 'node_make_sticky_action');
     $this->drupalPostForm(NULL, $edit, t('Apply'));
     // Re-load the node and check the status and sticky flag.
     $node = entity_load('node', $node->id(), TRUE);
     $this->assertTrue($node->isPublished(), 'Node has been published');
     $this->assertTrue($node->isSticky(), 'Node has been made sticky');
     // Make unsticky action.
     $edit = array('node_bulk_form[0]' => TRUE, 'action' => 'node_make_unsticky_action');
     $this->drupalPostForm(NULL, $edit, t('Apply'));
     // Re-load the node and check the sticky flag.
     $node = entity_load('node', $node->id(), TRUE);
     $this->assertFalse($node->isSticky(), 'Node is not sticky anymore');
     // Promote to front page.
     $node->setPublished(FALSE);
     $node->save();
     $this->assertFalse($node->isPromoted(), 'Node is not promoted to the front page');
     $edit = array('node_bulk_form[0]' => TRUE, 'action' => 'node_promote_action');
     $this->drupalPostForm(NULL, $edit, t('Apply'));
     // Re-load the node and check the status and promoted flag.
     $node = entity_load('node', $node->id(), TRUE);
     $this->assertTrue($node->isPublished(), 'Node has been published');
     $this->assertTrue($node->isPromoted(), 'Node has been promoted to the front page');
     // Demote from front page.
     $edit = array('node_bulk_form[0]' => TRUE, 'action' => 'node_unpromote_action');
     $this->drupalPostForm(NULL, $edit, t('Apply'));
     // Re-load the node and check the promoted flag.
     $node = entity_load('node', $node->id(), TRUE);
     $this->assertFalse($node->isPromoted(), 'Node has been demoted');
     // Delete node.
     $edit = array('node_bulk_form[0]' => TRUE, 'action' => 'node_delete_action');
     $this->drupalPostForm(NULL, $edit, t('Apply'));
     $this->drupalPostForm(NULL, array(), t('Delete'));
     // Re-load the node and check if it has been deleted.
     $node = entity_load('node', $node->id(), TRUE);
     $this->assertNull($node, 'Node has been deleted');
 }
 /**
  * Tests using entity fields of the telephone field type.
  */
 public function testTestItem()
 {
     // Verify entity creation.
     $entity = entity_create('entity_test');
     $value = '+0123456789';
     $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->field_test instanceof FieldItemListInterface, 'Field implements interface.');
     $this->assertTrue($entity->field_test[0] instanceof FieldItemInterface, 'Field item implements interface.');
     $this->assertEqual($entity->field_test->value, $value);
     $this->assertEqual($entity->field_test[0]->value, $value);
     // Verify changing the field value.
     $new_value = '+41' . rand(1000000, 9999999);
     $entity->field_test->value = $new_value;
     $this->assertEqual($entity->field_test->value, $new_value);
     // Read changed entity and assert changed values.
     $entity->save();
     $entity = entity_load('entity_test', $id);
     $this->assertEqual($entity->field_test->value, $new_value);
     // Test sample item generation.
     $entity = entity_create('entity_test');
     $entity->field_test->generateSampleItems();
     $this->entityValidateAndSave($entity);
 }
 protected function queryLoad($ids)
 {
     $multifields = multifield_get_fields();
     foreach (array_keys($multifields) as $field_name) {
         $query = new EntityFieldQuery();
         if ($ids) {
             $query->fieldCondition($field_name, 'id', $ids, 'IN');
         } else {
             $query->fieldCondition($field_name, 'id', 0, '>');
         }
         if ($results = $query->execute()) {
             $pseudo_entities = array();
             $field = field_info_field($field_name);
             foreach ($results as $entity_type => $entities) {
                 // Simply doing an entity load on the entities with multifield values
                 // will cause the cacheSet() from multifield_field_load() to get
                 // invoked.
                 $entities = entity_load($entity_type, array_keys($entities));
                 foreach ($entities as $entity) {
                     if ($items = field_get_items($entity_type, $entity, $field_name)) {
                         foreach ($items as $item) {
                             $pseudo_entities[$item['id']] = _multifield_field_item_to_entity($field['type'], $item);
                         }
                     }
                 }
             }
             $this->cacheSet($pseudo_entities);
         }
     }
     return array_intersect_key($this->entityCache, drupal_map_assoc($ids, $ids));
 }
 /**
  * Tests that the default 'comment_body' field is correctly added.
  */
 function testCommentDefaultFields()
 {
     // Do not make assumptions on default node types created by the test
     // installation profile, and create our own.
     $this->drupalCreateContentType(array('type' => 'test_node_type'));
     $this->container->get('comment.manager')->addDefaultField('node', 'test_node_type');
     // Check that the 'comment_body' field is present on the comment bundle.
     $field = FieldConfig::loadByName('comment', 'comment', 'comment_body');
     $this->assertTrue(!empty($field), 'The comment_body field is added when a comment bundle is created');
     $field->delete();
     // Check that the 'comment_body' field is deleted.
     $field_storage = FieldStorageConfig::loadByName('comment', 'comment_body');
     $this->assertTrue(empty($field_storage), 'The comment_body field was deleted');
     // Create a new content type.
     $type_name = 'test_node_type_2';
     $this->drupalCreateContentType(array('type' => $type_name));
     $this->container->get('comment.manager')->addDefaultField('node', $type_name);
     // Check that the 'comment_body' field exists and has an instance on the
     // new comment bundle.
     $field_storage = FieldStorageConfig::loadByName('comment', 'comment_body');
     $this->assertTrue($field_storage, 'The comment_body field exists');
     $field = FieldConfig::loadByName('comment', 'comment', 'comment_body');
     $this->assertTrue(isset($field), format_string('The comment_body field is present for comments on type @type', array('@type' => $type_name)));
     // Test adding a field that defaults to CommentItemInterface::CLOSED.
     $this->container->get('comment.manager')->addDefaultField('node', 'test_node_type', 'who_likes_ponies', CommentItemInterface::CLOSED, 'who_likes_ponies');
     $field = entity_load('field_config', 'node.test_node_type.who_likes_ponies');
     $this->assertEqual($field->default_value[0]['status'], CommentItemInterface::CLOSED);
 }
 /**
  * Tests Drupal 6 node type to Drupal 8 migration.
  */
 public function testNodeType()
 {
     $migration = entity_load('migration', 'd6_node_type');
     // 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($migration->getIdMap()->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($migration->getIdMap()->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($migration->getIdMap()->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.');
 }
Пример #29
0
 /**
  * {@inheritdoc}
  */
 public function nextMail()
 {
     // Get the current mail spool row and update the internal pointer to the
     // next row.
     $return = each($this->mails);
     // If we're done, return false.
     if (!$return) {
         return FALSE;
     }
     $spool_data = $return['value'];
     // Store this spool row as processed.
     $this->processed[$spool_data->msid] = $spool_data;
     $entity = entity_load($spool_data->entity_type, $spool_data->entity_id);
     if (!$entity) {
         // If the entity load failed, set the processed status done and proceed with
         // the next mail.
         $this->processed[$spool_data->msid]->result = array('status' => SpoolStorageInterface::STATUS_DONE, 'error' => TRUE);
         return $this->nextMail();
     }
     if ($spool_data->data) {
         $subscriber = $spool_data->data;
     } else {
         $subscriber = simplenews_subscriber_load_by_mail($spool_data->mail);
     }
     if (!$subscriber) {
         // If loading the subscriber failed, set the processed status done and
         // proceed with the next mail.
         $this->processed[$spool_data->msid]->result = array('status' => SpoolStorageInterface::STATUS_DONE, 'error' => TRUE);
         return $this->nextMail();
     }
     $mail = new MailEntity($entity, $subscriber, \Drupal::service('simplenews.mail_cache'));
     // Set the langcode langcode.
     $this->processed[$spool_data->msid]->langcode = $mail->getEntity()->language()->getId();
     return $mail;
 }
 /**
  * Checks block revision related operations.
  */
 public function testRevisions()
 {
     $blocks = $this->blocks;
     $logs = $this->revisionLogs;
     foreach ($blocks as $delta => $revision_id) {
         // Confirm the correct revision text appears.
         $loaded = entity_revision_load('block_content', $revision_id);
         // Verify revision log is the same.
         $this->assertEqual($loaded->getRevisionLog(), $logs[$delta], format_string('Correct log message found for revision !revision', array('!revision' => $loaded->getRevisionId())));
     }
     // Confirm that this is the default revision.
     $this->assertTrue($loaded->isDefaultRevision(), 'Third block revision is the default one.');
     // Make a new revision and set it to not be default.
     // This will create a new revision that is not "front facing".
     // Save this as a non-default revision.
     $loaded->setNewRevision();
     $loaded->isDefaultRevision(FALSE);
     $loaded->body = $this->randomMachineName(8);
     $loaded->save();
     $this->drupalGet('block/' . $loaded->id());
     $this->assertNoText($loaded->body->value, 'Revision body text is not present on default version of block.');
     // Verify that the non-default revision id is greater than the default
     // revision id.
     $default_revision = entity_load('block_content', $loaded->id());
     $this->assertTrue($loaded->getRevisionId() > $default_revision->getRevisionId(), 'Revision id is greater than default revision id.');
 }