diff options
author | xjm | 2018-07-06 21:41:47 (GMT) |
---|---|---|
committer | xjm | 2018-07-06 21:41:47 (GMT) |
commit | 00f65542ea044e8dc58d83424c5eb8bd51853cf4 (patch) | |
tree | 46994b055a94777ef1845e8d3e46b90faafeaa0d | |
parent | f5f92048b603b0ee7f17e52f50a7320332546aea (diff) |
Issue #2983458 by seanB, pguillard, msankhala, marcoscano: Use assertSame() instead of assertEquals() in Media tests
15 files changed, 142 insertions, 142 deletions
diff --git a/core/modules/media/tests/src/Functional/MediaBulkFormTest.php b/core/modules/media/tests/src/Functional/MediaBulkFormTest.php index 6bf9195..fb9caf1 100644 --- a/core/modules/media/tests/src/Functional/MediaBulkFormTest.php +++ b/core/modules/media/tests/src/Functional/MediaBulkFormTest.php @@ -63,7 +63,7 @@ class MediaBulkFormTest extends MediaFunctionalTestBase { // Check that all created items are present in the test view. $view = Views::getView('test_media_bulk_form'); $view->execute(); - $this->assertEquals($view->total_rows, 5); + $this->assertSame($view->total_rows, 5); // Check the operations are accessible to the logged in user. $this->drupalGet('test-media-bulk-form'); diff --git a/core/modules/media/tests/src/Functional/MediaOverviewPageTest.php b/core/modules/media/tests/src/Functional/MediaOverviewPageTest.php index 6bc1fe3..a955152 100644 --- a/core/modules/media/tests/src/Functional/MediaOverviewPageTest.php +++ b/core/modules/media/tests/src/Functional/MediaOverviewPageTest.php @@ -41,19 +41,19 @@ class MediaOverviewPageTest extends MediaFunctionalTestBase { $assert_session->selectExists('langcode'); $assert_session->buttonExists('Filter'); $header = $assert_session->elementExists('css', 'th#view-thumbnail-target-id-table-column'); - $this->assertEquals('Thumbnail', $header->getText()); + $this->assertSame('Thumbnail', $header->getText()); $header = $assert_session->elementExists('css', 'th#view-name-table-column'); - $this->assertEquals('Media name', $header->getText()); + $this->assertSame('Media name', $header->getText()); $header = $assert_session->elementExists('css', 'th#view-bundle-table-column'); - $this->assertEquals('Type', $header->getText()); + $this->assertSame('Type', $header->getText()); $header = $assert_session->elementExists('css', 'th#view-uid-table-column'); - $this->assertEquals('Author', $header->getText()); + $this->assertSame('Author', $header->getText()); $header = $assert_session->elementExists('css', 'th#view-status-table-column'); - $this->assertEquals('Status', $header->getText()); + $this->assertSame('Status', $header->getText()); $header = $assert_session->elementExists('css', 'th#view-changed-table-column'); - $this->assertEquals('Updated Sort ascending', $header->getText()); + $this->assertSame('Updated Sort ascending', $header->getText()); $header = $assert_session->elementExists('css', 'th#view-operations-table-column'); - $this->assertEquals('Operations', $header->getText()); + $this->assertSame('Operations', $header->getText()); $assert_session->pageTextContains('No media available.'); // Create some content for the view. @@ -97,50 +97,50 @@ class MediaOverviewPageTest extends MediaFunctionalTestBase { // Media names. $name1 = $assert_session->elementExists('css', 'td.views-field-name a', $row1); - $this->assertEquals($media1->label(), $name1->getText()); + $this->assertSame($media1->label(), $name1->getText()); $name2 = $assert_session->elementExists('css', 'td.views-field-name a', $row2); - $this->assertEquals($media2->label(), $name2->getText()); + $this->assertSame($media2->label(), $name2->getText()); $name3 = $assert_session->elementExists('css', 'td.views-field-name a', $row3); - $this->assertEquals($media3->label(), $name3->getText()); + $this->assertSame($media3->label(), $name3->getText()); $assert_session->linkByHrefExists('/media/' . $media1->id()); $assert_session->linkByHrefExists('/media/' . $media2->id()); $assert_session->linkByHrefExists('/media/' . $media3->id()); // Media types. $type_element1 = $assert_session->elementExists('css', 'td.views-field-bundle', $row1); - $this->assertEquals($media_type1->label(), $type_element1->getText()); + $this->assertSame($media_type1->label(), $type_element1->getText()); $type_element2 = $assert_session->elementExists('css', 'td.views-field-bundle', $row2); - $this->assertEquals($media_type2->label(), $type_element2->getText()); + $this->assertSame($media_type2->label(), $type_element2->getText()); $type_element3 = $assert_session->elementExists('css', 'td.views-field-bundle', $row3); - $this->assertEquals($media_type1->label(), $type_element3->getText()); + $this->assertSame($media_type1->label(), $type_element3->getText()); // Media authors. $author_element1 = $assert_session->elementExists('css', 'td.views-field-uid', $row1); - $this->assertEquals($this->adminUser->getDisplayName(), $author_element1->getText()); + $this->assertSame($this->adminUser->getDisplayName(), $author_element1->getText()); $author_element2 = $assert_session->elementExists('css', 'td.views-field-uid', $row2); - $this->assertEquals($this->adminUser->getDisplayName(), $author_element2->getText()); + $this->assertSame($this->adminUser->getDisplayName(), $author_element2->getText()); $author_element3 = $assert_session->elementExists('css', 'td.views-field-uid', $row3); - $this->assertEquals($this->nonAdminUser->getDisplayName(), $author_element3->getText()); + $this->assertSame($this->nonAdminUser->getDisplayName(), $author_element3->getText()); // Media publishing status. $status_element1 = $assert_session->elementExists('css', 'td.views-field-status', $row1); - $this->assertEquals('Published', $status_element1->getText()); + $this->assertSame('Published', $status_element1->getText()); $status_element2 = $assert_session->elementExists('css', 'td.views-field-status', $row2); - $this->assertEquals('Unpublished', $status_element2->getText()); + $this->assertSame('Unpublished', $status_element2->getText()); $status_element3 = $assert_session->elementExists('css', 'td.views-field-status', $row3); - $this->assertEquals('Published', $status_element3->getText()); + $this->assertSame('Published', $status_element3->getText()); // Timestamp. $expected = \Drupal::service('date.formatter')->format($media1->getChangedTime(), 'short'); $changed_element1 = $assert_session->elementExists('css', 'td.views-field-changed', $row1); - $this->assertEquals($expected, $changed_element1->getText()); + $this->assertSame($expected, $changed_element1->getText()); // Operations. $edit_link1 = $assert_session->elementExists('css', 'td.views-field-operations li.edit a', $row1); - $this->assertEquals('Edit', $edit_link1->getText()); + $this->assertSame('Edit', $edit_link1->getText()); $assert_session->linkByHrefExists('/media/' . $media1->id() . '/edit'); $delete_link1 = $assert_session->elementExists('css', 'td.views-field-operations li.delete a', $row1); - $this->assertEquals('Delete', $delete_link1->getText()); + $this->assertSame('Delete', $delete_link1->getText()); $assert_session->linkByHrefExists('/media/' . $media1->id() . '/delete'); } diff --git a/core/modules/media/tests/src/Functional/MediaTemplateSuggestionsTest.php b/core/modules/media/tests/src/Functional/MediaTemplateSuggestionsTest.php index d4e3566..916eb7c 100644 --- a/core/modules/media/tests/src/Functional/MediaTemplateSuggestionsTest.php +++ b/core/modules/media/tests/src/Functional/MediaTemplateSuggestionsTest.php @@ -39,7 +39,7 @@ class MediaTemplateSuggestionsTest extends MediaFunctionalTestBase { $variables['elements'] = $build; $suggestions = \Drupal::moduleHandler()->invokeAll('theme_suggestions_media', [$variables]); - $this->assertEquals($suggestions, ['media__full', 'media__' . $media_type->id(), 'media__' . $media_type->id() . '__full', 'media__source_' . $media_type->getSource()->getPluginId()], 'Found expected media suggestions.'); + $this->assertSame($suggestions, ['media__full', 'media__' . $media_type->id(), 'media__' . $media_type->id() . '__full', 'media__source_' . $media_type->getSource()->getPluginId()], 'Found expected media suggestions.'); } } diff --git a/core/modules/media/tests/src/Functional/MediaUiFunctionalTest.php b/core/modules/media/tests/src/Functional/MediaUiFunctionalTest.php index f820153..f45a33e 100644 --- a/core/modules/media/tests/src/Functional/MediaUiFunctionalTest.php +++ b/core/modules/media/tests/src/Functional/MediaUiFunctionalTest.php @@ -69,8 +69,8 @@ class MediaUiFunctionalTest extends MediaFunctionalTestBase { $media = $this->container->get('entity_type.manager') ->getStorage('media') ->loadUnchanged($media_id); - $this->assertEquals($media->getRevisionLogMessage(), $revision_log_message); - $this->assertEquals($media->getName(), $media_name); + $this->assertSame($media->getRevisionLogMessage(), $revision_log_message); + $this->assertSame($media->getName(), $media_name); $assert_session->titleEquals($media_name . ' | Drupal'); // Tests media edit form. @@ -86,7 +86,7 @@ class MediaUiFunctionalTest extends MediaFunctionalTestBase { $media = $this->container->get('entity_type.manager') ->getStorage('media') ->loadUnchanged($media_id); - $this->assertEquals($media->getName(), $media_name2); + $this->assertSame($media->getName(), $media_name2); $assert_session->titleEquals($media_name2 . ' | Drupal'); // Test that there is no empty vertical tabs element, if the container is @@ -118,7 +118,7 @@ class MediaUiFunctionalTest extends MediaFunctionalTestBase { $media = $this->container->get('entity_type.manager') ->getStorage('media') ->loadUnchanged($media_id); - $this->assertEquals($media->getRevisionLogMessage(), $revision_log_message); + $this->assertSame($media->getRevisionLogMessage(), $revision_log_message); $this->assertNotEquals($previous_revision_id, $media->getRevisionId()); // Test the status checkbox. @@ -486,7 +486,7 @@ class MediaUiFunctionalTest extends MediaFunctionalTestBase { $this->assertNotEmpty($link); foreach ($attributes as $attribute => $value) { - $this->assertEquals($link->getAttribute($attribute), $value); + $this->assertSame($link->getAttribute($attribute), $value); } } diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php index 76b1bad..591643b 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php @@ -63,7 +63,7 @@ class MediaDisplayTest extends MediaJavascriptTestBase { // Verify the name is present, and its text matches what is expected. $assert_session->elementExists('css', '.field--name-name'); $name_field = $page->find('css', '.field--name-name .field__item'); - $this->assertEquals($media->label(), $name_field->getText()); + $this->assertSame($media->label(), $name_field->getText()); // In the standard profile, there are some pre-cooked types. Make sure the // elements configured on their displays are the expected ones. @@ -85,14 +85,14 @@ class MediaDisplayTest extends MediaJavascriptTestBase { // Here we expect to see only the image, nothing else. // Assert only one element in the content region. - $this->assertEquals(1, count($page->findAll('css', '.media--type-image > div'))); + $this->assertSame(1, count($page->findAll('css', '.media--type-image > div'))); // Assert the image is present inside the media element. $media_item = $assert_session->elementExists('css', '.media--type-image > div'); $assert_session->elementExists('css', 'img', $media_item); // Assert that the image src is the original image and not an image style. $media_image = $assert_session->elementExists('css', '.media--type-image img'); $expected_image_src = file_url_transform_relative(file_create_url(\Drupal::token()->replace('public://[date:custom:Y]-[date:custom:m]/example_1.jpeg'))); - $this->assertEquals($expected_image_src, $media_image->getAttribute('src')); + $this->assertSame($expected_image_src, $media_image->getAttribute('src')); $test_filename = $this->randomMachineName() . '.txt'; $test_filepath = 'public://' . $test_filename; @@ -106,11 +106,11 @@ class MediaDisplayTest extends MediaJavascriptTestBase { // Here we expect to see only the linked filename. // Assert only one element in the content region. - $this->assertEquals(1, count($page->findAll('css', 'article.media--type-file > div'))); + $this->assertSame(1, count($page->findAll('css', 'article.media--type-file > div'))); // Assert the file link is present, and its text matches the filename. $assert_session->elementExists('css', 'article.media--type-file .field--name-field-media-file a'); $link = $page->find('css', 'article.media--type-file .field--name-field-media-file a'); - $this->assertEquals($test_filename, $link->getText()); + $this->assertSame($test_filename, $link->getText()); // Create a node type "page" to use as host entity. $node_type = NodeType::create([ @@ -170,7 +170,7 @@ class MediaDisplayTest extends MediaJavascriptTestBase { $assert_session->elementNotExists('css', '.field--name-name'); $assert_session->pageTextNotContains($image_media_name); // Only one element is present inside the media container. - $this->assertEquals(1, count($page->findAll('css', '.field--name-field-related-media article.media--type-image > div'))); + $this->assertSame(1, count($page->findAll('css', '.field--name-field-related-media article.media--type-image > div'))); // Assert the image is present. $assert_session->elementExists('css', '.field--name-field-related-media article.media--type-image img'); } diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaReferenceFieldHelpTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaReferenceFieldHelpTest.php index 7d22484..7c109c1 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaReferenceFieldHelpTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaReferenceFieldHelpTest.php @@ -49,7 +49,7 @@ class MediaReferenceFieldHelpTest extends MediaJavascriptTestBase { $page->selectFieldOption('edit-new-storage-type', $field_name); $field_description_element = $assert_session->elementExists('css', '#edit-description-' . Html::cleanCssIdentifier($field_name)); $this->assertTrue($field_description_element->isVisible()); - $this->assertEquals($help_text, $field_description_element->getText()); + $this->assertSame($help_text, $field_description_element->getText()); } } diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceFileTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceFileTest.php index 21954d8..55ef4dd 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceFileTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceFileTest.php @@ -69,9 +69,9 @@ class MediaSourceFileTest extends MediaSourceTestBase { // Load the media and check that all the fields are properly populated. $media = Media::load(1); - $this->assertEquals($test_filename, $media->getName()); - $this->assertEquals('8', $media->get('field_string_file_size')->value); - $this->assertEquals('text/plain', $media->get('field_string_mime_type')->value); + $this->assertSame($test_filename, $media->getName()); + $this->assertSame('8', $media->get('field_string_file_size')->value); + $this->assertSame('text/plain', $media->get('field_string_mime_type')->value); // Test the MIME type icon. $icon_base = \Drupal::config('media.settings')->get('icon_base_uri'); diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceImageTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceImageTest.php index 2be4321..8adb98a 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceImageTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceImageTest.php @@ -59,9 +59,9 @@ class MediaSourceImageTest extends MediaSourceTestBase { // 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); } } diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaUiJavascriptTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaUiJavascriptTest.php index 7af61fc..a00a3c2 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaUiJavascriptTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaUiJavascriptTest.php @@ -160,15 +160,15 @@ class MediaUiJavascriptTest extends MediaJavascriptTestBase { $loaded_media_type = $this->container->get('entity_type.manager') ->getStorage('media_type') ->load($this->testMediaType->id()); - $this->assertEquals($loaded_media_type->id(), $this->testMediaType->id()); - $this->assertEquals($loaded_media_type->label(), $new_name); - $this->assertEquals($loaded_media_type->getDescription(), $new_description); - $this->assertEquals($loaded_media_type->getSource()->getPluginId(), 'test'); - $this->assertEquals($loaded_media_type->getSource()->getConfiguration()['test_config_value'], 'This is new config value.'); + $this->assertSame($loaded_media_type->id(), $this->testMediaType->id()); + $this->assertSame($loaded_media_type->label(), $new_name); + $this->assertSame($loaded_media_type->getDescription(), $new_description); + $this->assertSame($loaded_media_type->getSource()->getPluginId(), 'test'); + $this->assertSame($loaded_media_type->getSource()->getConfiguration()['test_config_value'], 'This is new config value.'); $this->assertTrue($loaded_media_type->shouldCreateNewRevision()); $this->assertTrue($loaded_media_type->thumbnailDownloadsAreQueued()); $this->assertFalse($loaded_media_type->getStatus()); - $this->assertEquals($loaded_media_type->getFieldMap(), ['attribute_1' => 'name']); + $this->assertSame($loaded_media_type->getFieldMap(), ['attribute_1' => 'name']); // We need to clear the statically cached field definitions to account for // fields that have been created by API calls in this test, since they exist diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaViewsWizardTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaViewsWizardTest.php index 3be7b1a..b602137 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaViewsWizardTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaViewsWizardTest.php @@ -34,19 +34,19 @@ class MediaViewsWizardTest extends MediaJavascriptTestBase { $page->checkField('page[create]'); $page->fillField('page[path]', $this->randomMachineName(16)); $page->pressButton('Save and edit'); - $this->assertEquals($session->getCurrentUrl(), $this->baseUrl . '/admin/structure/views/view/' . $view_id); + $this->assertSame($session->getCurrentUrl(), $this->baseUrl . '/admin/structure/views/view/' . $view_id); $view = Views::getView($view_id); $view->initHandlers(); $row = $view->display_handler->getOption('row'); - $this->assertEquals($row['type'], 'fields'); + $this->assertSame($row['type'], 'fields'); // Check for the default filters. - $this->assertEquals($view->filter['status']->table, 'media_field_data'); - $this->assertEquals($view->filter['status']->field, 'status'); + $this->assertSame($view->filter['status']->table, 'media_field_data'); + $this->assertSame($view->filter['status']->field, 'status'); $this->assertTrue($view->filter['status']->value); // Check for the default fields. - $this->assertEquals($view->field['name']->table, 'media_field_data'); - $this->assertEquals($view->field['name']->field, 'name'); + $this->assertSame($view->field['name']->table, 'media_field_data'); + $this->assertSame($view->field['name']->field, 'name'); } @@ -67,23 +67,23 @@ class MediaViewsWizardTest extends MediaJavascriptTestBase { $page->checkField('page[create]'); $page->fillField('page[path]', $this->randomMachineName(16)); $page->pressButton('Save and edit'); - $this->assertEquals($session->getCurrentUrl(), $this->baseUrl . '/admin/structure/views/view/' . $view_id); + $this->assertSame($session->getCurrentUrl(), $this->baseUrl . '/admin/structure/views/view/' . $view_id); $view = Views::getView($view_id); $view->initHandlers(); $row = $view->display_handler->getOption('row'); - $this->assertEquals($row['type'], 'fields'); + $this->assertSame($row['type'], 'fields'); // Check for the default filters. - $this->assertEquals($view->filter['status']->table, 'media_field_revision'); - $this->assertEquals($view->filter['status']->field, 'status'); + $this->assertSame($view->filter['status']->table, 'media_field_revision'); + $this->assertSame($view->filter['status']->field, 'status'); $this->assertTrue($view->filter['status']->value); // Check for the default fields. - $this->assertEquals($view->field['name']->table, 'media_field_revision'); - $this->assertEquals($view->field['name']->field, 'name'); - $this->assertEquals($view->field['changed']->table, 'media_field_revision'); - $this->assertEquals($view->field['changed']->field, 'changed'); + $this->assertSame($view->field['name']->table, 'media_field_revision'); + $this->assertSame($view->field['name']->field, 'name'); + $this->assertSame($view->field['changed']->table, 'media_field_revision'); + $this->assertSame($view->field['changed']->field, 'changed'); } } diff --git a/core/modules/media/tests/src/Kernel/MediaCreationTest.php b/core/modules/media/tests/src/Kernel/MediaCreationTest.php index 93d4384..7eac84e 100644 --- a/core/modules/media/tests/src/Kernel/MediaCreationTest.php +++ b/core/modules/media/tests/src/Kernel/MediaCreationTest.php @@ -28,13 +28,13 @@ class MediaCreationTest extends MediaKernelTestBase { $this->container->get('module_installer')->install(['media_test_type']); $test_media_type = $media_type_storage->load('test'); $this->assertInstanceOf(MediaTypeInterface::class, $test_media_type, 'The media type from default configuration has not been created in the database.'); - $this->assertEquals('Test type', $test_media_type->get('label'), 'Could not assure the correct type name.'); - $this->assertEquals('Test type.', $test_media_type->get('description'), 'Could not assure the correct type description.'); - $this->assertEquals('test', $test_media_type->get('source'), 'Could not assure the correct media source.'); + $this->assertSame('Test type', $test_media_type->get('label'), 'Could not assure the correct type name.'); + $this->assertSame('Test type.', $test_media_type->get('description'), 'Could not assure the correct type description.'); + $this->assertSame('test', $test_media_type->get('source'), 'Could not assure the correct media source.'); // Source field is not set on the media source, but it should never // be created automatically when a config is being imported. - $this->assertEquals(['source_field' => '', 'test_config_value' => 'Kakec'], $test_media_type->get('source_configuration'), 'Could not assure the correct media source configuration.'); - $this->assertEquals(['metadata_attribute' => 'field_attribute_config_test'], $test_media_type->get('field_map'), 'Could not assure the correct field map.'); + $this->assertSame(['source_field' => '', 'test_config_value' => 'Kakec'], $test_media_type->get('source_configuration'), 'Could not assure the correct media source configuration.'); + $this->assertSame(['metadata_attribute' => 'field_attribute_config_test'], $test_media_type->get('field_map'), 'Could not assure the correct field map.'); // Check the Media Type access handler behavior. // We grant access to the 'view label' operation to all users having // permission to 'view media'. @@ -72,10 +72,10 @@ class MediaCreationTest extends MediaKernelTestBase { $this->assertNotInstanceOf(MediaInterface::class, Media::load(rand(1000, 9999)), 'Failed asserting a non-existent media.'); $this->assertInstanceOf(MediaInterface::class, Media::load($media->id()), 'The new media item has not been created in the database.'); - $this->assertEquals($this->testMediaType->id(), $media->bundle(), 'The media item was not created with the correct type.'); - $this->assertEquals('Unnamed', $media->getName(), 'The media item was not created with the correct name.'); + $this->assertSame($this->testMediaType->id(), $media->bundle(), 'The media item was not created with the correct type.'); + $this->assertSame('Unnamed', $media->getName(), 'The media item was not created with the correct name.'); $source_field_name = $media->bundle->entity->getSource()->getSourceFieldDefinition($media->bundle->entity)->getName(); - $this->assertEquals('Nation of sheep, ruled by wolves, owned by pigs.', $media->get($source_field_name)->value, 'Source returns incorrect source field value.'); + $this->assertSame('Nation of sheep, ruled by wolves, owned by pigs.', $media->get($source_field_name)->value, 'Source returns incorrect source field value.'); } } diff --git a/core/modules/media/tests/src/Kernel/MediaSourceFileTest.php b/core/modules/media/tests/src/Kernel/MediaSourceFileTest.php index 65d4723..c36f2b6 100644 --- a/core/modules/media/tests/src/Kernel/MediaSourceFileTest.php +++ b/core/modules/media/tests/src/Kernel/MediaSourceFileTest.php @@ -18,7 +18,7 @@ class MediaSourceFileTest extends MediaKernelTestBase { $media = $this->generateMedia('test.patch', $mediaType); $result = $media->validate(); $this->assertCount(1, $result); - $this->assertEquals('field_media_file.0', $result->get(0)->getPropertyPath()); + $this->assertSame('field_media_file.0', $result->get(0)->getPropertyPath()); $this->assertContains('Only files with the following extensions are allowed:', (string) $result->get(0)->getMessage()); // Create a random file that should pass. diff --git a/core/modules/media/tests/src/Kernel/MediaSourceTest.php b/core/modules/media/tests/src/Kernel/MediaSourceTest.php index 37434e5..53c5319 100644 --- a/core/modules/media/tests/src/Kernel/MediaSourceTest.php +++ b/core/modules/media/tests/src/Kernel/MediaSourceTest.php @@ -23,13 +23,13 @@ class MediaSourceTest extends MediaKernelTestBase { /** @var \Drupal\media\MediaInterface $media */ $media = Media::create(['bundle' => $this->testMediaType->id()]); $media_source = $media->getSource(); - $this->assertEquals('default_name', $media_source->getPluginDefinition()['default_name_metadata_attribute'], 'Default metadata attribute is not used for the default name.'); - $this->assertEquals('media:' . $media->bundle() . ':' . $media->uuid(), $media_source->getMetadata($media, 'default_name'), 'Value of the default name metadata attribute does not look correct.'); - $this->assertEquals('media:' . $media->bundle() . ':' . $media->uuid(), $media->getName(), 'Default name was not used correctly by getName().'); - $this->assertEquals($media->getName(), $media->label(), 'Default name and label are not the same.'); + $this->assertSame('default_name', $media_source->getPluginDefinition()['default_name_metadata_attribute'], 'Default metadata attribute is not used for the default name.'); + $this->assertSame('media:' . $media->bundle() . ':' . $media->uuid(), $media_source->getMetadata($media, 'default_name'), 'Value of the default name metadata attribute does not look correct.'); + $this->assertSame('media:' . $media->bundle() . ':' . $media->uuid(), $media->getName(), 'Default name was not used correctly by getName().'); + $this->assertSame($media->getName(), $media->label(), 'Default name and label are not the same.'); $media->save(); - $this->assertEquals('media:' . $media->bundle() . ':' . $media->uuid(), $media->getName(), 'Default name was not saved correctly.'); - $this->assertEquals($media->getName(), $media->label(), 'The label changed during save.'); + $this->assertSame('media:' . $media->bundle() . ':' . $media->uuid(), $media->getName(), 'Default name was not saved correctly.'); + $this->assertSame($media->getName(), $media->label(), 'The label changed during save.'); // Make sure that the user-supplied name is used. /** @var \Drupal\media\MediaInterface $media */ @@ -39,11 +39,11 @@ class MediaSourceTest extends MediaKernelTestBase { 'name' => $name, ]); $media_source = $media->getSource(); - $this->assertEquals('default_name', $media_source->getPluginDefinition()['default_name_metadata_attribute'], 'Default metadata attribute is not used for the default name.'); - $this->assertEquals('media:' . $media->bundle() . ':' . $media->uuid(), $media_source->getMetadata($media, 'default_name'), 'Value of the default name metadata attribute does not look correct.'); + $this->assertSame('default_name', $media_source->getPluginDefinition()['default_name_metadata_attribute'], 'Default metadata attribute is not used for the default name.'); + $this->assertSame('media:' . $media->bundle() . ':' . $media->uuid(), $media_source->getMetadata($media, 'default_name'), 'Value of the default name metadata attribute does not look correct.'); $media->save(); - $this->assertEquals($name, $media->getName(), 'User-supplied name was not set correctly.'); - $this->assertEquals($media->getName(), $media->label(), 'The user-supplied name does not match the label.'); + $this->assertSame($name, $media->getName(), 'User-supplied name was not set correctly.'); + $this->assertSame($media->getName(), $media->label(), 'The user-supplied name does not match the label.'); // Change the default name attribute and see if it is used to set the name. $name = 'Old Major'; @@ -52,11 +52,11 @@ class MediaSourceTest extends MediaKernelTestBase { /** @var \Drupal\media\MediaInterface $media */ $media = Media::create(['bundle' => $this->testMediaType->id()]); $media_source = $media->getSource(); - $this->assertEquals('alternative_name', $media_source->getPluginDefinition()['default_name_metadata_attribute'], 'Correct metadata attribute is not used for the default name.'); - $this->assertEquals($name, $media_source->getMetadata($media, 'alternative_name'), 'Value of the default name metadata attribute does not look correct.'); + $this->assertSame('alternative_name', $media_source->getPluginDefinition()['default_name_metadata_attribute'], 'Correct metadata attribute is not used for the default name.'); + $this->assertSame($name, $media_source->getMetadata($media, 'alternative_name'), 'Value of the default name metadata attribute does not look correct.'); $media->save(); - $this->assertEquals($name, $media->getName(), 'Default name was not set correctly.'); - $this->assertEquals($media->getName(), $media->label(), 'The default name does not match the label.'); + $this->assertSame($name, $media->getName(), 'Default name was not set correctly.'); + $this->assertSame($media->getName(), $media->label(), 'The default name does not match the label.'); } /** @@ -109,25 +109,25 @@ class MediaSourceTest extends MediaKernelTestBase { 'field_media_test' => 'some_value', ]); $media_source = $media->getSource(); - $this->assertEquals('Snowball', $media_source->getMetadata($media, $attribute_name), 'Value of the metadata attribute is not correct.'); + $this->assertSame('Snowball', $media_source->getMetadata($media, $attribute_name), 'Value of the metadata attribute is not correct.'); $media->save(); - $this->assertEquals('Snowball', $media->get($field_name)->value, 'Metadata attribute was not mapped to the field.'); + $this->assertSame('Snowball', $media->get($field_name)->value, 'Metadata attribute was not mapped to the field.'); // Change the metadata attribute value and re-save the entity. Field value // should stay the same. \Drupal::state()->set('media_source_test_attributes', [ $attribute_name => ['title' => 'Attribute to map', 'value' => 'Pinkeye'], ]); - $this->assertEquals('Pinkeye', $media_source->getMetadata($media, $attribute_name), 'Value of the metadata attribute is not correct.'); + $this->assertSame('Pinkeye', $media_source->getMetadata($media, $attribute_name), 'Value of the metadata attribute is not correct.'); $media->save(); - $this->assertEquals('Snowball', $media->get($field_name)->value, 'Metadata attribute was not mapped to the field.'); + $this->assertSame('Snowball', $media->get($field_name)->value, 'Metadata attribute was not mapped to the field.'); // Now change the value of the source field and make sure that the mapped // values update too. - $this->assertEquals('Pinkeye', $media_source->getMetadata($media, $attribute_name), 'Value of the metadata attribute is not correct.'); + $this->assertSame('Pinkeye', $media_source->getMetadata($media, $attribute_name), 'Value of the metadata attribute is not correct.'); $media->set('field_media_test', 'some_new_value'); $media->save(); - $this->assertEquals('Pinkeye', $media->get($field_name)->value, 'Metadata attribute was not mapped to the field.'); + $this->assertSame('Pinkeye', $media->get($field_name)->value, 'Metadata attribute was not mapped to the field.'); // Remove the value of the mapped field and make sure that it is re-mapped // on save. @@ -135,9 +135,9 @@ class MediaSourceTest extends MediaKernelTestBase { $attribute_name => ['title' => 'Attribute to map', 'value' => 'Snowball'], ]); $media->{$field_name}->value = NULL; - $this->assertEquals('Snowball', $media_source->getMetadata($media, $attribute_name), 'Value of the metadata attribute is not correct.'); + $this->assertSame('Snowball', $media_source->getMetadata($media, $attribute_name), 'Value of the metadata attribute is not correct.'); $media->save(); - $this->assertEquals('Snowball', $media->get($field_name)->value, 'Metadata attribute was not mapped to the field.'); + $this->assertSame('Snowball', $media->get($field_name)->value, 'Metadata attribute was not mapped to the field.'); } /** @@ -172,10 +172,10 @@ class MediaSourceTest extends MediaKernelTestBase { 'field_media_test' => 'some_value', ]); $media_source = $media->getSource(); - $this->assertEquals('public://thumbnail1.jpg', $media_source->getMetadata($media, 'thumbnail_uri'), 'Value of the thumbnail metadata attribute is not correct.'); + $this->assertSame('public://thumbnail1.jpg', $media_source->getMetadata($media, 'thumbnail_uri'), 'Value of the thumbnail metadata attribute is not correct.'); $media->save(); - $this->assertEquals('public://thumbnail1.jpg', $media->thumbnail->entity->getFileUri(), 'Thumbnail was not added to the media item.'); - $this->assertEquals('Mr. Jones', $media->thumbnail->title, 'Title text was not set on the thumbnail.'); + $this->assertSame('public://thumbnail1.jpg', $media->thumbnail->entity->getFileUri(), 'Thumbnail was not added to the media item.'); + $this->assertSame('Mr. Jones', $media->thumbnail->title, 'Title text was not set on the thumbnail.'); $this->assertEquals('Thumbnail', $media->thumbnail->alt, 'Alt text was not set on the thumbnail.'); // Now change the metadata attribute and make sure that the thumbnail stays @@ -183,18 +183,18 @@ class MediaSourceTest extends MediaKernelTestBase { \Drupal::state()->set('media_source_test_attributes', [ 'thumbnail_uri' => ['title' => 'Thumbnail', 'value' => 'public://thumbnail2.jpg'], ]); - $this->assertEquals('public://thumbnail2.jpg', $media_source->getMetadata($media, 'thumbnail_uri'), 'Value of the thumbnail metadata attribute is not correct.'); + $this->assertSame('public://thumbnail2.jpg', $media_source->getMetadata($media, 'thumbnail_uri'), 'Value of the thumbnail metadata attribute is not correct.'); $media->save(); - $this->assertEquals('public://thumbnail1.jpg', $media->thumbnail->entity->getFileUri(), 'Thumbnail was not preserved.'); - $this->assertEquals('Mr. Jones', $media->thumbnail->title, 'Title text was not set on the thumbnail.'); + $this->assertSame('public://thumbnail1.jpg', $media->thumbnail->entity->getFileUri(), 'Thumbnail was not preserved.'); + $this->assertSame('Mr. Jones', $media->thumbnail->title, 'Title text was not set on the thumbnail.'); $this->assertEquals('Thumbnail', $media->thumbnail->alt, 'Alt text was not set on the thumbnail.'); // Remove the thumbnail and make sure that it is auto-updated on save. $media->thumbnail->target_id = NULL; - $this->assertEquals('public://thumbnail2.jpg', $media_source->getMetadata($media, 'thumbnail_uri'), 'Value of the thumbnail metadata attribute is not correct.'); + $this->assertSame('public://thumbnail2.jpg', $media_source->getMetadata($media, 'thumbnail_uri'), 'Value of the thumbnail metadata attribute is not correct.'); $media->save(); - $this->assertEquals('public://thumbnail2.jpg', $media->thumbnail->entity->getFileUri(), 'New thumbnail was not added to the media item.'); - $this->assertEquals('Mr. Jones', $media->thumbnail->title, 'Title text was not set on the thumbnail.'); + $this->assertSame('public://thumbnail2.jpg', $media->thumbnail->entity->getFileUri(), 'New thumbnail was not added to the media item.'); + $this->assertSame('Mr. Jones', $media->thumbnail->title, 'Title text was not set on the thumbnail.'); $this->assertEquals('Thumbnail', $media->thumbnail->alt, 'Alt text was not set on the thumbnail.'); // Change the metadata attribute again, change the source field value too @@ -203,10 +203,10 @@ class MediaSourceTest extends MediaKernelTestBase { 'thumbnail_uri' => ['title' => 'Thumbnail', 'value' => 'public://thumbnail1.jpg'], ]); $media->field_media_test->value = 'some_new_value'; - $this->assertEquals('public://thumbnail1.jpg', $media_source->getMetadata($media, 'thumbnail_uri'), 'Value of the thumbnail metadata attribute is not correct.'); + $this->assertSame('public://thumbnail1.jpg', $media_source->getMetadata($media, 'thumbnail_uri'), 'Value of the thumbnail metadata attribute is not correct.'); $media->save(); - $this->assertEquals('public://thumbnail1.jpg', $media->thumbnail->entity->getFileUri(), 'New thumbnail was not added to the media item.'); - $this->assertEquals('Mr. Jones', $media->thumbnail->title, 'Title text was not set on the thumbnail.'); + $this->assertSame('public://thumbnail1.jpg', $media->thumbnail->entity->getFileUri(), 'New thumbnail was not added to the media item.'); + $this->assertSame('Mr. Jones', $media->thumbnail->title, 'Title text was not set on the thumbnail.'); $this->assertEquals('Thumbnail', $media->thumbnail->alt, 'Alt text was not set on the thumbnail.'); // Change the thumbnail metadata attribute and make sure that the thumbnail @@ -222,11 +222,11 @@ class MediaSourceTest extends MediaKernelTestBase { 'field_media_test' => 'some_value', ]); $media_source = $media->getSource(); - $this->assertEquals('public://thumbnail1.jpg', $media_source->getMetadata($media, 'thumbnail_uri'), 'Value of the metadata attribute is not correct.'); - $this->assertEquals('public://thumbnail2.jpg', $media_source->getMetadata($media, 'alternative_thumbnail_uri'), 'Value of the thumbnail metadata attribute is not correct.'); + $this->assertSame('public://thumbnail1.jpg', $media_source->getMetadata($media, 'thumbnail_uri'), 'Value of the metadata attribute is not correct.'); + $this->assertSame('public://thumbnail2.jpg', $media_source->getMetadata($media, 'alternative_thumbnail_uri'), 'Value of the thumbnail metadata attribute is not correct.'); $media->save(); - $this->assertEquals('public://thumbnail2.jpg', $media->thumbnail->entity->getFileUri(), 'Correct metadata attribute was not used for the thumbnail.'); - $this->assertEquals('Mr. Jones', $media->thumbnail->title, 'Title text was not set on the thumbnail.'); + $this->assertSame('public://thumbnail2.jpg', $media->thumbnail->entity->getFileUri(), 'Correct metadata attribute was not used for the thumbnail.'); + $this->assertSame('Mr. Jones', $media->thumbnail->title, 'Title text was not set on the thumbnail.'); $this->assertEquals('Thumbnail', $media->thumbnail->alt, 'Alt text was not set on the thumbnail.'); // Enable queued thumbnails and make sure that the entity gets the default @@ -241,10 +241,10 @@ class MediaSourceTest extends MediaKernelTestBase { 'name' => 'Mr. Jones', 'field_media_test' => 'some_value', ]); - $this->assertEquals('public://thumbnail1.jpg', $media->getSource()->getMetadata($media, 'thumbnail_uri'), 'Value of the metadata attribute is not correct.'); + $this->assertSame('public://thumbnail1.jpg', $media->getSource()->getMetadata($media, 'thumbnail_uri'), 'Value of the metadata attribute is not correct.'); $media->save(); - $this->assertEquals('public://media-icons/generic/generic.png', $media->thumbnail->entity->getFileUri(), 'Default thumbnail was not set initially.'); - $this->assertEquals('Mr. Jones', $media->thumbnail->title, 'Title text was not set on the thumbnail.'); + $this->assertSame('public://media-icons/generic/generic.png', $media->thumbnail->entity->getFileUri(), 'Default thumbnail was not set initially.'); + $this->assertSame('Mr. Jones', $media->thumbnail->title, 'Title text was not set on the thumbnail.'); $this->assertEquals('Thumbnail', $media->thumbnail->alt, 'Alt text was not set on the thumbnail.'); // Process the queue item and make sure that the thumbnail was updated too. @@ -252,19 +252,19 @@ class MediaSourceTest extends MediaKernelTestBase { /** @var \Drupal\Core\Queue\QueueWorkerInterface $queue_worker */ $queue_worker = \Drupal::service('plugin.manager.queue_worker')->createInstance($queue_name); $queue = \Drupal::queue($queue_name); - $this->assertEquals(1, $queue->numberOfItems(), 'Item was not added to the queue.'); + $this->assertSame(1, $queue->numberOfItems(), 'Item was not added to the queue.'); $item = $queue->claimItem(); - $this->assertEquals($media->id(), $item->data['id'], 'Queue item that was created does not belong to the correct entity.'); + $this->assertSame($media->id(), $item->data['id'], 'Queue item that was created does not belong to the correct entity.'); $queue_worker->processItem($item->data); $queue->deleteItem($item); - $this->assertEquals(0, $queue->numberOfItems(), 'Item was not removed from the queue.'); + $this->assertSame(0, $queue->numberOfItems(), 'Item was not removed from the queue.'); $media = Media::load($media->id()); - $this->assertEquals('public://thumbnail1.jpg', $media->thumbnail->entity->getFileUri(), 'Thumbnail was not updated by the queue.'); - $this->assertEquals('Mr. Jones', $media->thumbnail->title, 'Title text was not set on the thumbnail.'); - $this->assertEquals('Thumbnail', $media->thumbnail->alt, 'Alt text was not set on the thumbnail.'); + $this->assertSame('public://thumbnail1.jpg', $media->thumbnail->entity->getFileUri(), 'Thumbnail was not updated by the queue.'); + $this->assertSame('Mr. Jones', $media->thumbnail->title, 'Title text was not set on the thumbnail.'); + $this->assertSame('Thumbnail', $media->thumbnail->alt, 'Alt text was not set on the thumbnail.'); // Set alt and title metadata attributes and make sure they are used for the // thumbnail. @@ -282,9 +282,9 @@ class MediaSourceTest extends MediaKernelTestBase { 'field_media_test' => 'some_value', ]); $media->save(); - $this->assertEquals('Boxer', $media->getName(), 'Correct name was not set on the media item.'); - $this->assertEquals('This will be title.', $media->thumbnail->title, 'Title text was not set on the thumbnail.'); - $this->assertEquals('This will be alt.', $media->thumbnail->alt, 'Alt text was not set on the thumbnail.'); + $this->assertSame('Boxer', $media->getName(), 'Correct name was not set on the media item.'); + $this->assertSame('This will be title.', $media->thumbnail->title, 'Title text was not set on the thumbnail.'); + $this->assertSame('This will be alt.', $media->thumbnail->alt, 'Alt text was not set on the thumbnail.'); } /** @@ -373,17 +373,17 @@ class MediaSourceTest extends MediaKernelTestBase { // Test field storage. $this->assertTrue($field_storage->isNew(), 'Field storage is saved automatically.'); $this->assertFalse($field_storage->isLocked(), 'Field storage is not locked.'); - $this->assertEquals('string', $field_storage->getType(), 'Field is not of correct type.'); - $this->assertEquals('field_media_test_1', $field_storage->getName(), 'Incorrect field name is used.'); - $this->assertEquals('media', $field_storage->getTargetEntityTypeId(), 'Field is not targeting media entities.'); + $this->assertSame('string', $field_storage->getType(), 'Field is not of correct type.'); + $this->assertSame('field_media_test_1', $field_storage->getName(), 'Incorrect field name is used.'); + $this->assertSame('media', $field_storage->getTargetEntityTypeId(), 'Field is not targeting media entities.'); // Test field. $this->assertTrue($field->isNew(), 'Field is saved automatically.'); - $this->assertEquals('field_media_test_1', $field->getName(), 'Incorrect field name is used.'); - $this->assertEquals('string', $field->getType(), 'Field is of incorrect type.'); + $this->assertSame('field_media_test_1', $field->getName(), 'Incorrect field name is used.'); + $this->assertSame('string', $field->getType(), 'Field is of incorrect type.'); $this->assertTrue($field->isRequired(), 'Field is not required.'); $this->assertEquals('Test source', $field->label(), 'Incorrect label is used.'); - $this->assertEquals('test_type', $field->getTargetBundle(), 'Field is not targeting correct bundle.'); + $this->assertSame('test_type', $field->getTargetBundle(), 'Field is not targeting correct bundle.'); // Fields should be automatically saved only when creating the media type // using the media type creation form. Make sure that they are not saved @@ -408,17 +408,17 @@ class MediaSourceTest extends MediaKernelTestBase { // Test field storage. $this->assertTrue($field_storage->isNew(), 'Field storage is saved automatically.'); $this->assertFalse($field_storage->isLocked(), 'Field storage is not locked.'); - $this->assertEquals('string_long', $field_storage->getType(), 'Field is of incorrect type.'); - $this->assertEquals('field_media_test_constraints_1', $field_storage->getName(), 'Incorrect field name is used.'); - $this->assertEquals('media', $field_storage->getTargetEntityTypeId(), 'Field is not targeting media entities.'); + $this->assertSame('string_long', $field_storage->getType(), 'Field is of incorrect type.'); + $this->assertSame('field_media_test_constraints_1', $field_storage->getName(), 'Incorrect field name is used.'); + $this->assertSame('media', $field_storage->getTargetEntityTypeId(), 'Field is not targeting media entities.'); // Test field. $this->assertTrue($field->isNew(), 'Field is saved automatically.'); - $this->assertEquals('field_media_test_constraints_1', $field->getName(), 'Incorrect field name is used.'); - $this->assertEquals('string_long', $field->getType(), 'Field is of incorrect type.'); + $this->assertSame('field_media_test_constraints_1', $field->getName(), 'Incorrect field name is used.'); + $this->assertSame('string_long', $field->getType(), 'Field is of incorrect type.'); $this->assertTrue($field->isRequired(), 'Field is not required.'); $this->assertEquals('Test source with constraints', $field->label(), 'Incorrect label is used.'); - $this->assertEquals('test_constraints_type', $field->getTargetBundle(), 'Field is not targeting correct bundle.'); + $this->assertSame('test_constraints_type', $field->getTargetBundle(), 'Field is not targeting correct bundle.'); } /** @@ -434,26 +434,26 @@ class MediaSourceTest extends MediaKernelTestBase { /** @var \Drupal\media\MediaSourceInterface $source */ $source = $manager->createInstance('test', []); $source->submitConfigurationForm($form, $form_state); - $expected = ['test_config_value' => 'Somewhere over the rainbow.', 'source_field' => 'field_media_test_1']; - $this->assertEquals($expected, $source->getConfiguration(), 'Submitted values were saved correctly.'); + $expected = ['source_field' => 'field_media_test_1', 'test_config_value' => 'Somewhere over the rainbow.']; + $this->assertSame($expected, $source->getConfiguration(), 'Submitted values were saved correctly.'); // Try to save a NULL value. $form_state->setValue('test_config_value', NULL); $source->submitConfigurationForm($form, $form_state); $expected['test_config_value'] = NULL; - $this->assertEquals($expected, $source->getConfiguration(), 'Submitted values were saved correctly.'); + $this->assertSame($expected, $source->getConfiguration(), 'Submitted values were saved correctly.'); // Make sure that the config keys are determined correctly even if the // existing value is NULL. $form_state->setValue('test_config_value', 'Somewhere over the rainbow.'); $source->submitConfigurationForm($form, $form_state); $expected['test_config_value'] = 'Somewhere over the rainbow.'; - $this->assertEquals($expected, $source->getConfiguration(), 'Submitted values were saved correctly.'); + $this->assertSame($expected, $source->getConfiguration(), 'Submitted values were saved correctly.'); // Make sure that a non-relevant value will be skipped. $form_state->setValue('not_relevant', 'Should not be saved in the plugin.'); $source->submitConfigurationForm($form, $form_state); - $this->assertEquals($expected, $source->getConfiguration(), 'Submitted values were saved correctly.'); + $this->assertSame($expected, $source->getConfiguration(), 'Submitted values were saved correctly.'); } /** diff --git a/core/modules/media/tests/src/Kernel/MediaTest.php b/core/modules/media/tests/src/Kernel/MediaTest.php index ea76a2e..9c7ca28 100644 --- a/core/modules/media/tests/src/Kernel/MediaTest.php +++ b/core/modules/media/tests/src/Kernel/MediaTest.php @@ -31,7 +31,7 @@ class MediaTest extends MediaKernelTestBase { // Ensure media name is configurable on manage display. $this->assertTrue($field_definitions['name']->isDisplayConfigurable('view')); // Ensure it is not visible by default. - $this->assertEquals($field_definitions['name']->getDisplayOptions('view'), ['region' => 'hidden']); + $this->assertSame($field_definitions['name']->getDisplayOptions('view'), ['region' => 'hidden']); } } diff --git a/core/modules/media/tests/src/Kernel/MediaTranslationTest.php b/core/modules/media/tests/src/Kernel/MediaTranslationTest.php index 009e7c4..50f8a7b 100644 --- a/core/modules/media/tests/src/Kernel/MediaTranslationTest.php +++ b/core/modules/media/tests/src/Kernel/MediaTranslationTest.php @@ -93,10 +93,10 @@ class MediaTranslationTest extends MediaKernelTestBase { $result = $result && $item['value'] == $media_translation->{$source_field_definition->getName()}[$delta]->value; } $this->assertTrue($result, new FormattableMarkup('%language translation field value not correct.', ['%language' => $langcode])); - $this->assertEquals('public://' . $langcode . '.png', $media_translation->getSource()->getMetadata($media_translation, 'thumbnail_uri'), new FormattableMarkup('%language translation thumbnail metadata attribute is not correct.', ['%language' => $langcode])); - $this->assertEquals('public://' . $langcode . '.png', $media_translation->get('thumbnail')->entity->getFileUri(), new FormattableMarkup('%language translation thumbnail value is not correct.', ['%language' => $langcode])); + $this->assertSame('public://' . $langcode . '.png', $media_translation->getSource()->getMetadata($media_translation, 'thumbnail_uri'), new FormattableMarkup('%language translation thumbnail metadata attribute is not correct.', ['%language' => $langcode])); + $this->assertSame('public://' . $langcode . '.png', $media_translation->get('thumbnail')->entity->getFileUri(), new FormattableMarkup('%language translation thumbnail value is not correct.', ['%language' => $langcode])); $this->assertEquals('Test Thumbnail ' . $langcode, $media_translation->getSource()->getMetadata($media_translation, 'test_thumbnail_alt'), new FormattableMarkup('%language translation thumbnail alt metadata attribute is not correct.', ['%language' => $langcode])); - $this->assertEquals('Test Thumbnail ' . $langcode, $media_translation->get('thumbnail')->alt, new FormattableMarkup('%language translation thumbnail alt value is not correct.', ['%language' => $langcode])); + $this->assertSame('Test Thumbnail ' . $langcode, $media_translation->get('thumbnail')->alt, new FormattableMarkup('%language translation thumbnail alt value is not correct.', ['%language' => $langcode])); } } |