You are here

function MigrateUploadTest::testUpload in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/file/src/Tests/Migrate/d6/MigrateUploadTest.php \Drupal\file\Tests\Migrate\d6\MigrateUploadTest::testUpload()

Test upload migration from Drupal 6 to Drupal 8.

File

core/modules/file/src/Tests/Migrate/d6/MigrateUploadTest.php, line 66
Contains \Drupal\file\Tests\Migrate\d6\MigrateUploadTest.

Class

MigrateUploadTest
Migrate association data between nodes and files.

Namespace

Drupal\file\Tests\Migrate\d6

Code

function testUpload() {
  $this->container
    ->get('entity.manager')
    ->getStorage('node')
    ->resetCache([
    1,
    2,
  ]);
  $nodes = Node::loadMultiple([
    1,
    2,
  ]);
  $node = $nodes[1];
  $this
    ->assertIdentical(1, count($node->upload));
  $this
    ->assertIdentical('1', $node->upload[0]->target_id);
  $this
    ->assertIdentical('file 1-1-1', $node->upload[0]->description);
  $this
    ->assertIdentical(FALSE, $node->upload[0]
    ->isDisplayed());
  $node = $nodes[2];
  $this
    ->assertIdentical(2, count($node->upload));
  $this
    ->assertIdentical('3', $node->upload[0]->target_id);
  $this
    ->assertIdentical('file 2-3-3', $node->upload[0]->description);
  $this
    ->assertIdentical(FALSE, $node->upload[0]
    ->isDisplayed());
  $this
    ->assertIdentical('2', $node->upload[1]->target_id);
  $this
    ->assertIdentical(TRUE, $node->upload[1]
    ->isDisplayed());
  $this
    ->assertIdentical('file 2-3-2', $node->upload[1]->description);
}