Pull merge.
[yaffs-website] / web / core / modules / media / tests / src / FunctionalJavascript / MediaSourceImageTest.php
index 708cec0bd4045d3c4d89120ae01ec2f617288aa5..cb013805ad278c528bbaa01385f806ff9fccc4e1 100644 (file)
@@ -46,22 +46,27 @@ class MediaSourceImageTest extends MediaSourceTestBase {
 
     // Create a media item.
     $this->drupalGet("media/add/{$media_type_id}");
-    $page->attachFileToField("files[{$source_field_id}_0]", \Drupal::root() . '/core/modules/media/tests/fixtures/example_1.jpeg');
+    $page->attachFileToField("files[{$source_field_id}_0]", $this->root . '/core/modules/media/tests/fixtures/example_1.jpeg');
     $result = $assert_session->waitForButton('Remove');
     $this->assertNotEmpty($result);
     $page->fillField("{$source_field_id}[0][alt]", 'Image Alt Text 1');
     $page->pressButton('Save');
 
-    $assert_session->addressEquals('media/1');
+    $assert_session->addressEquals('admin/content/media');
+
+    // Get the media entity view URL from the creation message.
+    $this->drupalGet($this->assertLinkToCreatedMedia());
 
     // Make sure the thumbnail is displayed from uploaded image.
     $assert_session->elementAttributeContains('css', '.image-style-thumbnail', 'src', 'example_1.jpeg');
+    // Ensure the thumbnail has the correct alt attribute.
+    $assert_session->elementAttributeContains('css', '.image-style-thumbnail', 'alt', 'Image Alt Text 1');
 
     // Load the media and check that all fields are properly populated.
     $media = Media::load(1);
-    $this->assertEquals('example_1.jpeg', $media->getName());
-    $this->assertEquals('200', $media->get('field_string_width')->value);
-    $this->assertEquals('89', $media->get('field_string_height')->value);
+    $this->assertSame('example_1.jpeg', $media->getName());
+    $this->assertSame('200', $media->get('field_string_width')->value);
+    $this->assertSame('89', $media->get('field_string_height')->value);
   }
 
 }