You are here

class MigrateNodeCompleteTest in Drupal 9

Same name in this branch
  1. 9 core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeCompleteTest.php \Drupal\Tests\node\Kernel\Migrate\d6\MigrateNodeCompleteTest
  2. 9 core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeCompleteTest
Same name and namespace in other branches
  1. 8 core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeCompleteTest

Test class for a complete node migration for Drupal 7.

@group migrate_drupal_7

Hierarchy

Expanded class hierarchy of MigrateNodeCompleteTest

File

core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php, line 18

Namespace

Drupal\Tests\node\Kernel\Migrate\d7
View source
class MigrateNodeCompleteTest extends MigrateDrupal7TestBase {
  use FileMigrationSetupTrait;
  use CreateTestContentEntitiesTrait;
  use NodeMigrateTypeTestTrait;

  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'content_translation',
    'comment',
    'datetime',
    'image',
    'language',
    'link',
    'menu_ui',
    // Required for translation migrations.
    'migrate_drupal_multilingual',
    'node',
    'taxonomy',
    'telephone',
    'text',
  ];

  /**
   * The entity storage for node.
   *
   * @var \Drupal\Core\Entity\EntityStorageInterface
   */
  protected $nodeStorage;

  /**
   * {@inheritdoc}
   */
  protected function setUp() : void {
    parent::setUp();

    // Remove the classic node table made in setup.
    $this
      ->removeNodeMigrateMapTable(NodeMigrateType::NODE_MIGRATE_TYPE_CLASSIC, '7');
    $this
      ->fileMigrationSetup();
    $this
      ->installEntitySchema('comment');
    $this
      ->installEntitySchema('taxonomy_term');
    $this
      ->installSchema('comment', [
      'comment_entity_statistics',
    ]);
    $this
      ->installSchema('node', [
      'node_access',
    ]);
    $this
      ->installSchema('system', [
      'sequences',
    ]);
    $this
      ->createContent();
    $this->nodeStorage = $this->container
      ->get('entity_type.manager')
      ->getStorage('node');
    $this->nodeStorage
      ->delete($this->nodeStorage
      ->loadMultiple());
    $this
      ->migrateUsers();
    $this
      ->migrateFields();
    $this
      ->executeMigrations([
      'language',
      'd7_language_content_settings',
      'd7_comment_field',
      'd7_comment_field_instance',
      'd7_node_complete',
    ]);
    $this->nodeStorage = $this->container
      ->get('entity_type.manager')
      ->getStorage('node');
  }

  /**
   * {@inheritdoc}
   */
  protected function getFileMigrationInfo() {
    return [
      'path' => 'public://sites/default/files/cube.jpeg',
      'size' => '3620',
      'base_path' => 'public://',
      'plugin_id' => 'd7_file',
    ];
  }

  /**
   * Tests the complete node migration.
   */
  public function testNodeCompleteMigration() {

    // Confirm there are only complete node migration map tables. This shows
    // that only the complete migration ran.
    $results = $this
      ->nodeMigrateMapTableCount('7');
    $this
      ->assertSame(0, $results['node']);
    $this
      ->assertSame(8, $results['node_complete']);
    $db = \Drupal::database();
    $this
      ->assertEquals($this
      ->expectedNodeFieldRevisionTable(), $db
      ->select('node_field_revision', 'nr')
      ->fields('nr')
      ->orderBy('vid')
      ->orderBy('langcode')
      ->execute()
      ->fetchAll(\PDO::FETCH_ASSOC));
    $this
      ->assertEquals($this
      ->expectedNodeFieldDataTable(), $db
      ->select('node_field_data', 'nr')
      ->fields('nr')
      ->orderBy('nid')
      ->orderBy('vid')
      ->orderBy('langcode')
      ->execute()
      ->fetchAll(\PDO::FETCH_ASSOC));

    // Load and test each revision.
    $data = $this
      ->expectedRevisionEntityData()[0];
    foreach ($this
      ->expectedNodeFieldRevisionTable() as $key => $revision) {
      $this
        ->assertRevision($revision, $data[$key]);
    }

    // Test the migration of node and user reference fields.
    foreach ([
      2,
      3,
    ] as $revision_id) {
      $revision = $this->nodeStorage
        ->loadRevision($revision_id);
      $this
        ->assertCount(1, $revision->field_node_reference);
      $this
        ->assertSame('5', $revision->field_node_reference->target_id);
      $this
        ->assertCount(1, $revision->field_user_reference);
      $this
        ->assertSame('Bob', $revision->field_user_reference[0]->entity
        ->getAccountName());
    }

    // Test the order in multi-value fields.
    $revision = $this->nodeStorage
      ->loadRevision(1);
    $this
      ->assertSame([
      [
        'value' => 'default@example.com',
      ],
      [
        'value' => 'another@example.com',
      ],
    ], $revision
      ->get('field_email')
      ->getValue());
    $this
      ->assertSame([
      [
        'target_id' => '17',
      ],
      [
        'target_id' => '15',
      ],
    ], $revision
      ->get('field_term_entityreference')
      ->getValue());
  }

  /**
   * Tests rollback of the complete node migration.
   */
  public function testRollbackNodeComplete() {
    $db = \Drupal::database();
    $node_types = [
      'article',
      'blog',
      'book',
      'forum',
      'page',
      'test_content_type',
    ];
    foreach ($node_types as $node_type) {

      // Execute the rollback.
      $this->migration = $this
        ->getMigration("d7_node_complete:{$node_type}");
      (new MigrateExecutable($this->migration, $this))
        ->rollback();

      // Assert there are no nodes of node_type.
      $count = $db
        ->select('node_field_data')
        ->condition('type', $node_type)
        ->countQuery()
        ->execute()
        ->fetchField();
      $this
        ->assertSame($count, '0', "There are {$count} nodes of type {$node_type}");
    }
  }

  /**
   * Asserts various aspects of a node revision.
   *
   * @param array $revision
   *   An array of revision data matching a node_field_revision table row.
   * @param array $data
   *   An array of revision data.
   */
  protected function assertRevision(array $revision, array $data) {

    /** @var  \Drupal\node\NodeInterface $actual */
    $actual = $this->nodeStorage
      ->loadRevision($revision['vid'])
      ->getTranslation($revision['langcode']);
    $this
      ->assertInstanceOf(NodeInterface::class, $actual);
    $this
      ->assertSame($revision['title'], $actual
      ->getTitle(), sprintf("Title '%s' does not match actual '%s' for revision '%d' langcode '%s'", $revision['title'], $actual
      ->getTitle(), $revision['vid'], $revision['langcode']));
    $this
      ->assertSame($revision['revision_translation_affected'], $actual
      ->get('revision_translation_affected')->value, sprintf("revision_translation_affected '%s' does not match actual '%s' for revision '%d' langcode '%s'", $revision['revision_translation_affected'], $actual
      ->get('revision_translation_affected')->value, $revision['vid'], $revision['langcode']));
    $this
      ->assertSame($data['revision_created'], $actual
      ->getRevisionCreationTime(), sprintf("Creation time '%s' does not match actual '%s' for revision '%d' langcode '%s'", $data['revision_created'], $actual
      ->getRevisionCreationTime(), $revision['vid'], $revision['langcode']));
    $this
      ->assertSame($data['log'], $actual
      ->getRevisionLogMessage(), sprintf("Revision log '%s' does not match actual '%s' for revision '%d' langcode '%s'", var_export($data['log'], TRUE), $actual
      ->getRevisionLogMessage(), $revision['vid'], $revision['langcode']));
    if (isset($data['field_text_long_plain'])) {
      $this
        ->assertSame($data['field_text_long_plain'], $actual->field_text_long_plain->value, sprintf("field_text_long_plain value '%s' does not match actual '%s' for revision '%d' langcode '%s'", var_export($data['field_text_long_plain'], TRUE), $actual->field_text_long_plain->value, $revision['vid'], $revision['langcode']));
    }
    if (isset($data['field_tree'])) {
      $this
        ->assertSame($data['field_tree'], $actual->field_tree->value, sprintf("field_tree value '%s' does not match actual '%s' for revision '%d' langcode '%s'", var_export($data['field_tree'], TRUE), $actual->field_tree->value, $revision['vid'], $revision['langcode']));
    }
  }

  /**
   * Provides the expected node_field_data table.
   *
   * @return array
   *   The expected table rows.
   */
  protected function expectedNodeFieldDataTable() {
    return [
      0 => [
        'nid' => '1',
        'vid' => '1',
        'type' => 'test_content_type',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '2',
        'title' => 'An English Node',
        'created' => '1529615790',
        'changed' => '1529615790',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => '1',
        'content_translation_source' => NULL,
        'content_translation_outdated' => '0',
      ],
      1 => [
        'nid' => '2',
        'vid' => '12',
        'type' => 'article',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '2',
        'title' => 'The thing about Deep Space 9',
        'created' => '1441306772',
        'changed' => '1564543637',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => NULL,
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      2 => [
        'nid' => '2',
        'vid' => '12',
        'type' => 'article',
        'langcode' => 'is',
        'status' => '1',
        'uid' => '1',
        'title' => 'is - The thing about Deep Space 9',
        'created' => '1471428152',
        'changed' => '1564543706',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '0',
        'revision_translation_affected' => '1',
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      3 => [
        'nid' => '4',
        'vid' => '14',
        'type' => 'article',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '1',
        'title' => 'en - The thing about Firefly',
        'created' => '1478755314',
        'changed' => '1564543929',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '0',
        'revision_translation_affected' => '1',
        'content_translation_source' => 'is',
        'content_translation_outdated' => '0',
      ],
      4 => [
        'nid' => '4',
        'vid' => '14',
        'type' => 'article',
        'langcode' => 'is',
        'status' => '1',
        'uid' => '1',
        'title' => 'is - The thing about Firefly',
        'created' => '1478755274',
        'changed' => '1564543810',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => NULL,
        'content_translation_source' => 'is',
        'content_translation_outdated' => '0',
      ],
      5 => [
        'nid' => '6',
        'vid' => '6',
        'type' => 'forum',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '1',
        'title' => 'Comments are closed :-(',
        'created' => '1504715414',
        'changed' => '1504715414',
        'promote' => '0',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => '1',
        'content_translation_source' => NULL,
        'content_translation_outdated' => '0',
      ],
      6 => [
        'nid' => '7',
        'vid' => '7',
        'type' => 'forum',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '1',
        'title' => 'Comments are open :-)',
        'created' => '1504715432',
        'changed' => '1504715432',
        'promote' => '0',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => '1',
        'content_translation_source' => NULL,
        'content_translation_outdated' => '0',
      ],
      7 => [
        'nid' => '8',
        'vid' => '10',
        'type' => 'blog',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '1',
        'title' => 'The number 47',
        'created' => '1551000341',
        'changed' => '1552126247',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => NULL,
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      8 => [
        'nid' => '8',
        'vid' => '10',
        'type' => 'blog',
        'langcode' => 'fr',
        'status' => '1',
        'uid' => '1',
        'title' => 'fr - The number 47',
        'created' => '1552126296',
        'changed' => '1552126296',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '0',
        'revision_translation_affected' => NULL,
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      9 => [
        'nid' => '8',
        'vid' => '10',
        'type' => 'blog',
        'langcode' => 'is',
        'status' => '1',
        'uid' => '1',
        'title' => 'is - The number 47',
        'created' => '1552126363',
        'changed' => '1552126363',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '0',
        'revision_translation_affected' => '1',
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      10 => [
        'nid' => '11',
        'vid' => '18',
        'type' => 'et',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '1',
        'title' => 'Page one',
        'created' => '1568261523',
        'changed' => '1568261687',
        'promote' => '0',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => NULL,
        'content_translation_source' => '',
        'content_translation_outdated' => '0',
      ],
      11 => [
        'nid' => '11',
        'vid' => '18',
        'type' => 'et',
        'langcode' => 'fr',
        'status' => '1',
        'uid' => '1',
        'title' => 'Page one',
        'created' => '1568261721',
        'changed' => '1568261721',
        'promote' => '0',
        'sticky' => '0',
        'default_langcode' => '0',
        'revision_translation_affected' => '1',
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      12 => [
        'nid' => '11',
        'vid' => '18',
        'type' => 'et',
        'langcode' => 'is',
        'status' => '1',
        'uid' => '1',
        'title' => 'Page one',
        'created' => '1568261548',
        'changed' => '1568261548',
        'promote' => '0',
        'sticky' => '0',
        'default_langcode' => '0',
        'revision_translation_affected' => NULL,
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
    ];
  }

  /**
   * Provides the expected node_field_revision table.
   *
   * @return array
   *   The table.
   */
  protected function expectedNodeFieldRevisionTable() {
    return [
      0 => [
        'nid' => '1',
        'vid' => '1',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '2',
        'title' => 'An English Node',
        'created' => '1529615790',
        'changed' => '1529615790',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => '1',
        'content_translation_source' => NULL,
        'content_translation_outdated' => '0',
      ],
      1 => [
        'nid' => '2',
        'vid' => '2',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '2',
        'title' => 'The thing about Deep Space 9 (1st rev)',
        'created' => '1441306772',
        'changed' => '1564543588',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => '1',
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      2 => [
        'nid' => '2',
        'vid' => '3',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '2',
        'title' => 'The thing about Deep Space 9 (1st rev)',
        'created' => '1441306772',
        'changed' => '1564543588',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => NULL,
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      3 => [
        'nid' => '2',
        'vid' => '3',
        'langcode' => 'is',
        'status' => '1',
        'uid' => '1',
        'title' => 'is - The thing about Deep Space 9 (1st rev)',
        'created' => '1471428152',
        'changed' => '1564543677',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '0',
        'revision_translation_affected' => '1',
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      4 => [
        'nid' => '4',
        'vid' => '4',
        'langcode' => 'is',
        'status' => '1',
        'uid' => '1',
        'title' => 'is - The thing about Firefly (1st rev)',
        'created' => '1478755274',
        'changed' => '1478755274',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => '1',
        'content_translation_source' => 'is',
        'content_translation_outdated' => '0',
      ],
      5 => [
        'nid' => '4',
        'vid' => '5',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '1',
        'title' => 'en - The thing about Firefly (1st rev)',
        'created' => '1478755314',
        'changed' => '1564543887',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '0',
        'revision_translation_affected' => '1',
        'content_translation_source' => 'is',
        'content_translation_outdated' => '0',
      ],
      6 => [
        'nid' => '4',
        'vid' => '5',
        'langcode' => 'is',
        'status' => '1',
        'uid' => '1',
        'title' => 'is - The thing about Firefly (1st rev)',
        'created' => '1478755274',
        'changed' => '1478755274',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => NULL,
        'content_translation_source' => 'is',
        'content_translation_outdated' => '0',
      ],
      7 => [
        'nid' => '6',
        'vid' => '6',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '1',
        'title' => 'Comments are closed :-(',
        'created' => '1504715414',
        'changed' => '1504715414',
        'promote' => '0',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => '1',
        'content_translation_source' => NULL,
        'content_translation_outdated' => '0',
      ],
      8 => [
        'nid' => '7',
        'vid' => '7',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '1',
        'title' => 'Comments are open :-)',
        'created' => '1504715432',
        'changed' => '1504715432',
        'promote' => '0',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => '1',
        'content_translation_source' => NULL,
        'content_translation_outdated' => '0',
      ],
      9 => [
        'nid' => '8',
        'vid' => '8',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '1',
        'title' => 'The number 47',
        'created' => '1551000341',
        'changed' => '1552126247',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => '1',
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      10 => [
        'nid' => '8',
        'vid' => '9',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '1',
        'title' => 'The number 47',
        'created' => '1551000341',
        'changed' => '1552126247',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => NULL,
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      11 => [
        'nid' => '8',
        'vid' => '9',
        'langcode' => 'fr',
        'status' => '1',
        'uid' => '1',
        'title' => 'fr - The number 47',
        'created' => '1552126296',
        'changed' => '1552126296',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '0',
        'revision_translation_affected' => '1',
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      12 => [
        'nid' => '8',
        'vid' => '10',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '1',
        'title' => 'The number 47',
        'created' => '1551000341',
        'changed' => '1552126247',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => NULL,
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      13 => [
        'nid' => '8',
        'vid' => '10',
        'langcode' => 'fr',
        'status' => '1',
        'uid' => '1',
        'title' => 'fr - The number 47',
        'created' => '1552126296',
        'changed' => '1552126296',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '0',
        'revision_translation_affected' => NULL,
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      14 => [
        'nid' => '8',
        'vid' => '10',
        'langcode' => 'is',
        'status' => '1',
        'uid' => '1',
        'title' => 'is - The number 47',
        'created' => '1552126363',
        'changed' => '1552126363',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '0',
        'revision_translation_affected' => '1',
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      15 => [
        'nid' => '2',
        'vid' => '11',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '2',
        'title' => 'The thing about Deep Space 9',
        'created' => '1441306772',
        'changed' => '1564543637',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => '1',
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      16 => [
        'nid' => '2',
        'vid' => '11',
        'langcode' => 'is',
        'status' => '1',
        'uid' => '1',
        'title' => 'is - The thing about Deep Space 9 (1st rev)',
        'created' => '1471428152',
        'changed' => '1564543637',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '0',
        'revision_translation_affected' => '1',
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      17 => [
        'nid' => '2',
        'vid' => '12',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '2',
        'title' => 'The thing about Deep Space 9',
        'created' => '1441306772',
        'changed' => '1564543637',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => NULL,
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      18 => [
        'nid' => '2',
        'vid' => '12',
        'langcode' => 'is',
        'status' => '1',
        'uid' => '1',
        'title' => 'is - The thing about Deep Space 9',
        'created' => '1471428152',
        'changed' => '1564543706',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '0',
        'revision_translation_affected' => '1',
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      19 => [
        'nid' => '4',
        'vid' => '13',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '1',
        'title' => 'en - The thing about Firefly (1st rev)',
        'created' => '1478755314',
        'changed' => '1564543887',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '0',
        'revision_translation_affected' => NULL,
        'content_translation_source' => 'is',
        'content_translation_outdated' => '0',
      ],
      20 => [
        'nid' => '4',
        'vid' => '13',
        'langcode' => 'is',
        'status' => '1',
        'uid' => '1',
        'title' => 'is - The thing about Firefly',
        'created' => '1478755274',
        'changed' => '1564543810',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => '1',
        'content_translation_source' => 'is',
        'content_translation_outdated' => '0',
      ],
      21 => [
        'nid' => '4',
        'vid' => '14',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '1',
        'title' => 'en - The thing about Firefly',
        'created' => '1478755314',
        'changed' => '1564543929',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '0',
        'revision_translation_affected' => '1',
        'content_translation_source' => 'is',
        'content_translation_outdated' => '0',
      ],
      22 => [
        'nid' => '4',
        'vid' => '14',
        'langcode' => 'is',
        'status' => '1',
        'uid' => '1',
        'title' => 'is - The thing about Firefly',
        'created' => '1478755274',
        'changed' => '1564543810',
        'promote' => '1',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => NULL,
        'content_translation_source' => 'is',
        'content_translation_outdated' => '0',
      ],
      23 => [
        'nid' => '11',
        'vid' => '15',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '1',
        'title' => 'Page one',
        'created' => '1568261523',
        'changed' => '1568261523',
        'promote' => '0',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => '1',
        'content_translation_source' => NULL,
        'content_translation_outdated' => '0',
      ],
      24 => [
        'nid' => '11',
        'vid' => '16',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '1',
        'title' => 'Page one',
        'created' => '1568261523',
        'changed' => '1568261523',
        'promote' => '0',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => NULL,
        'content_translation_source' => '',
        'content_translation_outdated' => '0',
      ],
      25 => [
        'nid' => '11',
        'vid' => '16',
        'langcode' => 'is',
        'status' => '1',
        'uid' => '1',
        'title' => 'Page one',
        'created' => '1568261548',
        'changed' => '1568261548',
        'promote' => '0',
        'sticky' => '0',
        'default_langcode' => '0',
        'revision_translation_affected' => '1',
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      26 => [
        'nid' => '11',
        'vid' => '17',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '1',
        'title' => 'Page one',
        'created' => '1568261523',
        'changed' => '1568261687',
        'promote' => '0',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => NULL,
        'content_translation_source' => '',
        'content_translation_outdated' => '0',
      ],
      27 => [
        'nid' => '11',
        'vid' => '17',
        'langcode' => 'is',
        'status' => '1',
        'uid' => '1',
        'title' => 'Page one',
        'created' => '1568261548',
        'changed' => '1568261548',
        'promote' => '0',
        'sticky' => '0',
        'default_langcode' => '0',
        'revision_translation_affected' => NULL,
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      28 => [
        'nid' => '11',
        'vid' => '18',
        'langcode' => 'en',
        'status' => '1',
        'uid' => '1',
        'title' => 'Page one',
        'created' => '1568261523',
        'changed' => '1568261687',
        'promote' => '0',
        'sticky' => '0',
        'default_langcode' => '1',
        'revision_translation_affected' => NULL,
        'content_translation_source' => '',
        'content_translation_outdated' => '0',
      ],
      29 => [
        'nid' => '11',
        'vid' => '18',
        'langcode' => 'fr',
        'status' => '1',
        'uid' => '1',
        'title' => 'Page one',
        'created' => '1568261721',
        'changed' => '1568261721',
        'promote' => '0',
        'sticky' => '0',
        'default_langcode' => '0',
        'revision_translation_affected' => '1',
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
      30 => [
        'nid' => '11',
        'vid' => '18',
        'langcode' => 'is',
        'status' => '1',
        'uid' => '1',
        'title' => 'Page one',
        'created' => '1568261548',
        'changed' => '1568261548',
        'promote' => '0',
        'sticky' => '0',
        'default_langcode' => '0',
        'revision_translation_affected' => NULL,
        'content_translation_source' => 'en',
        'content_translation_outdated' => '0',
      ],
    ];
  }

  /**
   * Provides the expected node_field_revision table.
   *
   * @return array
   *   Selected properties and fields on the revision.
   */
  protected function expectedRevisionEntityData() {
    return [
      $revision_data = [
        // Node 1, revision 1, en.
        0 => [
          'log' => NULL,
          'field_text_long_plain' => NULL,
          'revision_created' => '1529615790',
        ],
        // Node 2, revision 2, en.
        1 => [
          'log' => 'DS9 1st rev',
          'field_text_long_plain' => 'DS9 1st rev',
          'revision_created' => '1564543588',
        ],
        // Node 2, revision 3, en.
        2 => [
          'log' => 'is - DS9 1st rev',
          'field_text_long_plain' => 'DS9 1st rev',
          'revision_created' => '1564543677',
        ],
        // Node 2, revision 3, is.
        3 => [
          'log' => 'is - DS9 1st rev',
          'field_text_long_plain' => 'is - DS9 1st rev',
          'revision_created' => '1564543677',
        ],
        // Node 4, revision 4, is.
        4 => [
          'log' => 'is - Firefly 1st rev',
          'field_text_long_plain' => NULL,
          'revision_created' => '1478755274',
        ],
        // Node 4, revision 5, en.
        5 => [
          'log' => 'Firefly 1st rev',
          'field_text_long_plain' => NULL,
          'revision_created' => '1564543887',
        ],
        // Node 4, revision 5, is.
        6 => [
          'log' => 'Firefly 1st rev',
          'field_text_long_plain' => NULL,
          'revision_created' => '1564543887',
        ],
        // Node 6, revision 6, en.
        7 => [
          'log' => NULL,
          'field_text_long_plain' => NULL,
          'revision_created' => '1504715414',
        ],
        // Node 7, revision 7, en.
        8 => [
          'log' => NULL,
          'field_text_long_plain' => NULL,
          'revision_created' => '1504715432',
        ],
        // Node 8, revision 8, en.
        9 => [
          'log' => NULL,
          'field_text_long_plain' => NULL,
          'revision_created' => '1552126247',
        ],
        // Node 8, revision 9, en.
        10 => [
          'log' => NULL,
          'field_text_long_plain' => NULL,
          'revision_created' => '1552126296',
        ],
        // Node 8, revision 9, fr.
        11 => [
          'log' => NULL,
          'field_text_long_plain' => NULL,
          'revision_created' => '1552126296',
        ],
        // Node 8, revision 10, en.
        12 => [
          'log' => NULL,
          'field_text_long_plain' => NULL,
          'revision_created' => '1552126363',
        ],
        // Node 8, revision 10, fr.
        13 => [
          'log' => NULL,
          'field_text_long_plain' => NULL,
          'revision_created' => '1552126363',
        ],
        // Node 8, revision 10, is.
        14 => [
          'log' => NULL,
          'field_text_long_plain' => NULL,
          'revision_created' => '1552126363',
        ],
        // Node 2, revision 11, en.
        15 => [
          'log' => 'DS9 2nd rev',
          'field_text_long_plain' => NULL,
          'revision_created' => '1564543637',
        ],
        // Node 2, revision 11, is.
        16 => [
          'log' => 'DS9 2nd rev',
          'field_text_long_plain' => NULL,
          'revision_created' => '1564543637',
        ],
        // Node 2, revision 12, en.
        17 => [
          'log' => 'is - DS9 2nd rev',
          'field_text_long_plain' => NULL,
          'revision_created' => '1564543706',
        ],
        // Node 2, revision 12, is.
        18 => [
          'log' => 'is - DS9 2nd rev',
          'field_text_long_plain' => NULL,
          'revision_created' => '1564543706',
        ],
        // Node 4, revision 13, en.
        19 => [
          'log' => 'is - Firefly 2nd rev',
          'field_text_long_plain' => NULL,
          'revision_created' => '1564543810',
        ],
        // Node 4, revision 13, is.
        20 => [
          'log' => 'is - Firefly 2nd rev',
          'field_text_long_plain' => NULL,
          'revision_created' => '1564543810',
        ],
        // Node 4, revision 14, en.
        21 => [
          'log' => 'Firefly 2nd rev',
          'field_text_long_plain' => NULL,
          'revision_created' => '1564543929',
        ],
        // Node 4, revision 14, is.
        22 => [
          'log' => 'Firefly 2nd rev',
          'field_text_long_plain' => NULL,
          'revision_created' => '1564543929',
        ],
        // Node 11, revision 15, en.
        23 => [
          'log' => NULL,
          'body' => '1st',
          'field_tree' => 'lancewood',
          'revision_created' => '1568261523',
        ],
        // Node 11, revision 16, en.
        24 => [
          'log' => NULL,
          'body' => '1st',
          'field_tree' => 'lancewood',
          'revision_created' => '1568261548',
        ],
        // Node 11, revision 16, is.
        25 => [
          'log' => NULL,
          'body' => '1st',
          'field_tree' => 'is - lancewood',
          'revision_created' => '1568261548',
        ],
        // Node 11, revision 17, en.
        26 => [
          'log' => '2nd',
          'body' => '2nd',
          'field_tree' => 'lancewood',
          'revision_created' => '1568261548',
        ],
        // Node 11, revision 17, is.
        27 => [
          'log' => '2nd',
          'body' => '2nd',
          'field_tree' => 'is - lancewood',
          'revision_created' => '1568261548',
        ],
        // Node 11, revision 18, en.
        28 => [
          'log' => NULL,
          'body' => '2nd',
          'field_tree' => 'lancewood',
          'revision_created' => '1568261548',
        ],
        // Node 11, revision 18, f5.
        29 => [
          'log' => NULL,
          'body' => '2nd',
          'field_tree' => 'fr - lancewood',
          'revision_created' => '1568261548',
        ],
        // Node 11, revision 18, is.
        30 => [
          'log' => NULL,
          'body' => '2nd',
          'field_tree' => 'is - lancewood',
          'revision_created' => '1568261548',
        ],
      ],
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AssertContentTrait::$content protected property The current raw content.
AssertContentTrait::$drupalSettings protected property The drupalSettings value from the current raw $content.
AssertContentTrait::$elements protected property The XML structure parsed from the current raw $content. 1
AssertContentTrait::$plainTextContent protected property The plain-text content of raw $content (text nodes).
AssertContentTrait::assertEscaped protected function Passes if the raw text IS found escaped on the loaded page, fail otherwise.
AssertContentTrait::assertField protected function Asserts that a field exists with the given name or ID.
AssertContentTrait::assertFieldById protected function Asserts that a field exists with the given ID and value.
AssertContentTrait::assertFieldByName protected function Asserts that a field exists with the given name and value.
AssertContentTrait::assertFieldByXPath protected function Asserts that a field exists in the current page by the given XPath.
AssertContentTrait::assertFieldChecked protected function Asserts that a checkbox field in the current page is checked.
AssertContentTrait::assertFieldsByValue protected function Asserts that a field exists in the current page with a given Xpath result.
AssertContentTrait::assertLink protected function Passes if a link with the specified label is found.
AssertContentTrait::assertLinkByHref protected function Passes if a link containing a given href (part) is found.
AssertContentTrait::assertNoDuplicateIds protected function Asserts that each HTML ID is used for just a single element.
AssertContentTrait::assertNoEscaped protected function Passes if the raw text IS NOT found escaped on the loaded page, fail otherwise.
AssertContentTrait::assertNoField protected function Asserts that a field does not exist with the given name or ID.
AssertContentTrait::assertNoFieldById protected function Asserts that a field does not exist with the given ID and value.
AssertContentTrait::assertNoFieldByName protected function Asserts that a field does not exist with the given name and value.
AssertContentTrait::assertNoFieldByXPath protected function Asserts that a field does not exist or its value does not match, by XPath.
AssertContentTrait::assertNoFieldChecked protected function Asserts that a checkbox field in the current page is not checked.
AssertContentTrait::assertNoLink protected function Passes if a link with the specified label is not found.
AssertContentTrait::assertNoLinkByHref protected function Passes if a link containing a given href (part) is not found.
AssertContentTrait::assertNoLinkByHrefInMainRegion protected function Passes if a link containing a given href is not found in the main region.
AssertContentTrait::assertNoOption protected function Asserts that a select option in the current page does not exist.
AssertContentTrait::assertNoOptionSelected protected function Asserts that a select option in the current page is not checked.
AssertContentTrait::assertNoPattern protected function Triggers a pass if the perl regex pattern is not found in raw content.
AssertContentTrait::assertNoRaw protected function Passes if the raw text is NOT found on the loaded page, fail otherwise.
AssertContentTrait::assertNoText protected function Passes if the page (with HTML stripped) does not contains the text.
AssertContentTrait::assertNoTitle protected function Pass if the page title is not the given string.
AssertContentTrait::assertNoUniqueText protected function Passes if the text is found MORE THAN ONCE on the text version of the page.
AssertContentTrait::assertOption protected function Asserts that a select option in the current page exists.
AssertContentTrait::assertOptionByText protected function Asserts that a select option with the visible text exists.
AssertContentTrait::assertOptionSelected protected function Asserts that a select option in the current page is checked.
AssertContentTrait::assertOptionSelectedWithDrupalSelector protected function Asserts that a select option in the current page is checked.
AssertContentTrait::assertOptionWithDrupalSelector protected function Asserts that a select option in the current page exists.
AssertContentTrait::assertPattern protected function Triggers a pass if the Perl regex pattern is found in the raw content.
AssertContentTrait::assertRaw protected function Passes if the raw text IS found on the loaded page, fail otherwise.
AssertContentTrait::assertText protected function Passes if the page (with HTML stripped) contains the text.
AssertContentTrait::assertTextHelper protected function Helper for assertText and assertNoText.
AssertContentTrait::assertTextPattern protected function Asserts that a Perl regex pattern is found in the plain-text content.
AssertContentTrait::assertThemeOutput protected function Asserts themed output.
AssertContentTrait::assertTitle protected function Pass if the page title is the given string.
AssertContentTrait::assertUniqueText protected function Passes if the text is found ONLY ONCE on the text version of the page.
AssertContentTrait::assertUniqueTextHelper protected function Helper for assertUniqueText and assertNoUniqueText.
AssertContentTrait::buildXPathQuery protected function Builds an XPath query.
AssertContentTrait::constructFieldXpath protected function Helper: Constructs an XPath for the given set of attributes and value.
AssertContentTrait::cssSelect protected function Searches elements using a CSS selector in the raw content.
AssertContentTrait::getAllOptions protected function Get all option elements, including nested options, in a select.
AssertContentTrait::getDrupalSettings protected function Gets the value of drupalSettings for the currently-loaded page.
AssertContentTrait::getRawContent protected function Gets the current raw content.
AssertContentTrait::getSelectedItem protected function Get the selected value from a select field.
AssertContentTrait::getTextContent protected function Retrieves the plain-text content from the current raw content.
AssertContentTrait::getUrl protected function Get the current URL from the cURL handler. 1
AssertContentTrait::parse protected function Parse content returned from curlExec using DOM and SimpleXML.
AssertContentTrait::removeWhiteSpace protected function Removes all white-space between HTML tags from the raw content.
AssertContentTrait::setDrupalSettings protected function Sets the value of drupalSettings for the currently-loaded page.
AssertContentTrait::setRawContent protected function Sets the raw content (e.g. HTML).
AssertContentTrait::xpath protected function Performs an xpath search on the contents of the internal browser.
AssertLegacyTrait::assert Deprecated protected function
AssertLegacyTrait::assertEqual Deprecated protected function
AssertLegacyTrait::assertIdentical Deprecated protected function
AssertLegacyTrait::assertIdenticalObject Deprecated protected function
AssertLegacyTrait::assertNotEqual Deprecated protected function
AssertLegacyTrait::assertNotIdentical Deprecated protected function
AssertLegacyTrait::pass Deprecated protected function
AssertLegacyTrait::verbose Deprecated protected function
ConfigTestTrait::configImporter protected function Returns a ConfigImporter object to import test configuration.
ConfigTestTrait::copyConfig protected function Copies configuration objects from source storage to target storage.
CreateTestContentEntitiesTrait::createContent protected function Create several pieces of generic content.
CreateTestContentEntitiesTrait::createContentPostUpgrade protected function Create several pieces of generic content.
CreateTestContentEntitiesTrait::getRequiredModules protected function Gets required modules.
CreateTestContentEntitiesTrait::installEntitySchemas protected function Install required entity schemas.
ExtensionListTestTrait::getModulePath protected function Gets the path for the specified module.
ExtensionListTestTrait::getThemePath protected function Gets the path for the specified theme.
FileMigrationSetupTrait::assertEntity protected function Tests a single file entity. 1
FileMigrationSetupTrait::fileMigrationSetup protected function Prepare the file migration for running.
KernelTestBase::$backupGlobals protected property Back up and restore any global variables that may be changed by tests.
KernelTestBase::$backupStaticAttributes protected property Back up and restore static class properties that may be changed by tests.
KernelTestBase::$backupStaticAttributesBlacklist protected property Contains a few static class properties for performance.
KernelTestBase::$classLoader protected property
KernelTestBase::$configImporter protected property @todo Move into Config test base class. 7
KernelTestBase::$configSchemaCheckerExclusions protected static property An array of config object names that are excluded from schema checking.
KernelTestBase::$container protected property
KernelTestBase::$databasePrefix protected property
KernelTestBase::$preserveGlobalState protected property Do not forward any global state from the parent process to the processes that run the actual tests.
KernelTestBase::$root protected property The app root.
KernelTestBase::$runTestInSeparateProcess protected property Kernel tests are run in separate processes because they allow autoloading of code from extensions. Running the test in a separate process isolates this behavior from other tests. Subclasses should not override this property.
KernelTestBase::$siteDirectory protected property
KernelTestBase::$strictConfigSchema protected property Set to TRUE to strict check all configuration saved. 6
KernelTestBase::$vfsRoot protected property The virtual filesystem root directory.
KernelTestBase::assertPostConditions protected function 1
KernelTestBase::bootEnvironment protected function Bootstraps a basic test environment.
KernelTestBase::bootKernel private function Bootstraps a kernel for a test.
KernelTestBase::config protected function Configuration accessor for tests. Returns non-overridden configuration.
KernelTestBase::disableModules protected function Disables modules for this test.
KernelTestBase::enableModules protected function Enables modules for this test.
KernelTestBase::getConfigSchemaExclusions protected function Gets the config schema exclusions for this test.
KernelTestBase::getDatabaseConnectionInfo protected function Returns the Database connection info to be used for this test. 3
KernelTestBase::getDatabasePrefix public function
KernelTestBase::getExtensionsForModules private function Returns Extension objects for $modules to enable.
KernelTestBase::getModulesToEnable private static function Returns the modules to enable for this test.
KernelTestBase::initFileCache protected function Initializes the FileCache component.
KernelTestBase::installConfig protected function Installs default configuration for a given list of modules.
KernelTestBase::installEntitySchema protected function Installs the storage schema for a specific entity type.
KernelTestBase::installSchema protected function Installs database tables from a module schema definition.
KernelTestBase::prepareTemplate protected function
KernelTestBase::register public function Registers test-specific services. Overrides ServiceProviderInterface::register 24
KernelTestBase::render protected function Renders a render array. 1
KernelTestBase::setInstallProfile protected function Sets the install profile and rebuilds the container to update it.
KernelTestBase::setSetting protected function Sets an in-memory Settings variable.
KernelTestBase::setUpBeforeClass public static function 1
KernelTestBase::setUpFilesystem protected function Sets up the filesystem, so things like the file directory. 2
KernelTestBase::stop protected function Stops test execution.
KernelTestBase::tearDownCloseDatabaseConnection public function @after
KernelTestBase::vfsDump protected function Dumps the current state of the virtual filesystem to STDOUT.
KernelTestBase::__sleep public function Prevents serializing any properties.
MigrateDrupal7TestBase::getFixtureFilePath protected function Gets the path to the fixture file.
MigrateDrupal7TestBase::migrateCommentTypes protected function Migrates comment types.
MigrateDrupal7TestBase::migrateContent protected function Executes all content migrations.
MigrateDrupal7TestBase::migrateContentTypes protected function Migrates node types.
MigrateDrupal7TestBase::migrateFields protected function Executes all field migrations.
MigrateDrupal7TestBase::migrateTaxonomyTerms protected function Executes all taxonomy term migrations.
MigrateDrupal7TestBase::migrateUsers protected function Executes all user migrations.
MigrateDrupalTestBase::loadFixture protected function Loads a database fixture into the source database connection.
MigrateNodeCompleteTest::$modules protected static property Modules to enable. Overrides MigrateDrupalTestBase::$modules
MigrateNodeCompleteTest::$nodeStorage protected property The entity storage for node.
MigrateNodeCompleteTest::assertRevision protected function Asserts various aspects of a node revision.
MigrateNodeCompleteTest::expectedNodeFieldDataTable protected function Provides the expected node_field_data table.
MigrateNodeCompleteTest::expectedNodeFieldRevisionTable protected function Provides the expected node_field_revision table.
MigrateNodeCompleteTest::expectedRevisionEntityData protected function Provides the expected node_field_revision table.
MigrateNodeCompleteTest::getFileMigrationInfo protected function Returns information about the file to be migrated. Overrides FileMigrationSetupTrait::getFileMigrationInfo
MigrateNodeCompleteTest::setUp protected function Overrides MigrateDrupal7TestBase::setUp
MigrateNodeCompleteTest::testNodeCompleteMigration public function Tests the complete node migration.
MigrateNodeCompleteTest::testRollbackNodeComplete public function Tests rollback of the complete node migration.
MigrateTestBase::$collectMessages protected property TRUE to collect messages instead of displaying them.
MigrateTestBase::$logger protected property A logger prophecy object. 2
MigrateTestBase::$migrateMessages protected property A two dimensional array of messages.
MigrateTestBase::$migration protected property The primary migration being tested. 1
MigrateTestBase::$sourceDatabase protected property The source database connection.
MigrateTestBase::cleanupMigrateConnection private function Cleans up the test migrate connection.
MigrateTestBase::createMigrationConnection private function Changes the database connection to the prefixed one.
MigrateTestBase::display public function Displays a migrate message. Overrides MigrateMessageInterface::display
MigrateTestBase::executeMigration protected function Executes a single migration.
MigrateTestBase::executeMigrations protected function Executes a set of migrations in dependency order.
MigrateTestBase::getMigration protected function Gets the migration plugin.
MigrateTestBase::mockFailure protected function Records a failure in the map table of a specific migration.
MigrateTestBase::prepareMigration protected function Modify a migration's configuration before executing it.
MigrateTestBase::prepareMigrations protected function Prepare any dependent migrations.
MigrateTestBase::setTestLogger protected function Injects the test logger into the container.
MigrateTestBase::startCollectingMessages public function Start collecting messages and erase previous messages.
MigrateTestBase::stopCollectingMessages public function Stop collecting messages.
MigrateTestBase::tearDown protected function Overrides KernelTestBase::tearDown
NodeMigrateTypeTestTrait::$tableName public property The migrate_map table name.
NodeMigrateTypeTestTrait::getTableName protected function Gets the migrate_map table name.
NodeMigrateTypeTestTrait::makeNodeMigrateMapTable protected function Create a node migrate_map table.
NodeMigrateTypeTestTrait::nodeMigrateMapTableCount protected function Gets the numbers of complete and classic node migrate_map tables.
NodeMigrateTypeTestTrait::removeNodeMigrateMapTable protected function Remove the node migrate map table.
PhpUnitWarnings::$deprecationWarnings private static property Deprecation warnings from PHPUnit to raise with @trigger_error().
PhpUnitWarnings::addWarning public function Converts PHPUnit deprecation warnings to E_USER_DEPRECATED.
RandomGeneratorTrait::$randomGenerator protected property The random generator.
RandomGeneratorTrait::getRandomGenerator protected function Gets the random generator for the utility methods.
RandomGeneratorTrait::randomMachineName protected function Generates a unique random string containing letters and numbers. 1
RandomGeneratorTrait::randomObject public function Generates a random PHP object.
RandomGeneratorTrait::randomString public function Generates a pseudo-random string of ASCII characters of codes 32 to 126.
RandomGeneratorTrait::randomStringValidate public function Callback for random string validation.
StorageCopyTrait::replaceStorageContents protected static function Copy the configuration from one storage to another and remove stale items.
TestRequirementsTrait::checkModuleRequirements private function Checks missing module requirements.
TestRequirementsTrait::checkRequirements protected function Check module requirements for the Drupal use case. 1
TestRequirementsTrait::getDrupalRoot protected static function Returns the Drupal root directory.