7fc0b0bafb3423aaae9818a588ad7b388d398acc
[yaffs-website] / web / core / modules / image / tests / src / Kernel / Migrate / d6 / MigrateImageTest.php
1 <?php
2
3 namespace Drupal\Tests\image\Kernel\Migrate\d6;
4
5 use Drupal\node\Entity\Node;
6 use Drupal\Tests\node\Kernel\Migrate\d6\MigrateNodeTestBase;
7 use Drupal\Tests\file\Kernel\Migrate\d6\FileMigrationTestTrait;
8
9 /**
10  * Image migration test.
11  *
12  * This extends the node test, because the D6 fixture has images; they just
13  * need to be migrated into D8.
14  *
15  * @group migrate_drupal_6
16  */
17 class MigrateImageTest extends MigrateNodeTestBase {
18
19   use FileMigrationTestTrait;
20
21   /**
22    * {@inheritdoc}
23    */
24   public static $modules = ['menu_ui'];
25
26   /**
27    * {@inheritdoc}
28    */
29   protected function setUp() {
30     parent::setUp();
31     $this->setUpMigratedFiles();
32     $this->installSchema('file', ['file_usage']);
33     $this->executeMigrations([
34       'd6_node',
35     ]);
36   }
37
38   /**
39    * Test image migration from Drupal 6 to 8.
40    */
41   public function testNode() {
42     $node = Node::load(9);
43     // Test the image field sub fields.
44     $this->assertSame('2', $node->field_test_imagefield->target_id);
45     $this->assertSame('Test alt', $node->field_test_imagefield->alt);
46     $this->assertSame('Test title', $node->field_test_imagefield->title);
47     $this->assertSame('80', $node->field_test_imagefield->width);
48     $this->assertSame('60', $node->field_test_imagefield->height);
49   }
50
51 }