Mercurial > hg > isophonics-drupal-site
comparison core/modules/media/tests/src/FunctionalJavascript/MediaSourceImageTest.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
44 $page->selectFieldOption("field_map[" . Image::METADATA_ATTRIBUTE_HEIGHT . "]", 'field_string_height'); | 44 $page->selectFieldOption("field_map[" . Image::METADATA_ATTRIBUTE_HEIGHT . "]", 'field_string_height'); |
45 $page->pressButton('Save'); | 45 $page->pressButton('Save'); |
46 | 46 |
47 // Create a media item. | 47 // Create a media item. |
48 $this->drupalGet("media/add/{$media_type_id}"); | 48 $this->drupalGet("media/add/{$media_type_id}"); |
49 $page->attachFileToField("files[{$source_field_id}_0]", \Drupal::root() . '/core/modules/media/tests/fixtures/example_1.jpeg'); | 49 $page->attachFileToField("files[{$source_field_id}_0]", $this->root . '/core/modules/media/tests/fixtures/example_1.jpeg'); |
50 $result = $assert_session->waitForButton('Remove'); | 50 $result = $assert_session->waitForButton('Remove'); |
51 $this->assertNotEmpty($result); | 51 $this->assertNotEmpty($result); |
52 $page->fillField("{$source_field_id}[0][alt]", 'Image Alt Text 1'); | 52 $page->fillField("{$source_field_id}[0][alt]", 'Image Alt Text 1'); |
53 $page->pressButton('Save'); | 53 $page->pressButton('Save'); |
54 | 54 |
55 $assert_session->addressEquals('media/1'); | 55 $assert_session->addressEquals('admin/content/media'); |
56 | |
57 // Get the media entity view URL from the creation message. | |
58 $this->drupalGet($this->assertLinkToCreatedMedia()); | |
56 | 59 |
57 // Make sure the thumbnail is displayed from uploaded image. | 60 // Make sure the thumbnail is displayed from uploaded image. |
58 $assert_session->elementAttributeContains('css', '.image-style-thumbnail', 'src', 'example_1.jpeg'); | 61 $assert_session->elementAttributeContains('css', '.image-style-thumbnail', 'src', 'example_1.jpeg'); |
62 // Ensure the thumbnail has the correct alt attribute. | |
63 $assert_session->elementAttributeContains('css', '.image-style-thumbnail', 'alt', 'Image Alt Text 1'); | |
59 | 64 |
60 // Load the media and check that all fields are properly populated. | 65 // Load the media and check that all fields are properly populated. |
61 $media = Media::load(1); | 66 $media = Media::load(1); |
62 $this->assertEquals('example_1.jpeg', $media->getName()); | 67 $this->assertSame('example_1.jpeg', $media->getName()); |
63 $this->assertEquals('200', $media->get('field_string_width')->value); | 68 $this->assertSame('200', $media->get('field_string_width')->value); |
64 $this->assertEquals('89', $media->get('field_string_height')->value); | 69 $this->assertSame('89', $media->get('field_string_height')->value); |
65 } | 70 } |
66 | 71 |
67 } | 72 } |