diff -u b/core/modules/media/tests/src/Kernel/MediaSourceTest.php b/core/modules/media/tests/src/Kernel/MediaSourceTest.php --- b/core/modules/media/tests/src/Kernel/MediaSourceTest.php +++ b/core/modules/media/tests/src/Kernel/MediaSourceTest.php @@ -176,7 +176,7 @@ $media->save(); $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->assertSame('Thumbnail', $media->thumbnail->alt, 'Alt 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 // the same. @@ -187,7 +187,7 @@ $media->save(); $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->assertSame('Thumbnail', $media->thumbnail->alt, 'Alt 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; @@ -195,7 +195,7 @@ $media->save(); $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->assertSame('Thumbnail', $media->thumbnail->alt, 'Alt 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 // and make sure that the thumbnail updates. @@ -207,7 +207,7 @@ $media->save(); $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->assertSame('Thumbnail', $media->thumbnail->alt, 'Alt 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 // is set correctly. @@ -227,7 +227,7 @@ $media->save(); $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->assertSame('Thumbnail', $media->thumbnail->alt, 'Alt 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 // thumbnail initially. @@ -245,7 +245,7 @@ $media->save(); $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->assertSame('Thumbnail', $media->thumbnail->alt, 'Alt 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. $queue_name = 'media_entity_thumbnail'; @@ -309,7 +309,7 @@ /** @var \Drupal\Core\Entity\EntityConstraintViolationListInterface $violations */ $violations = $media->validate(); $this->assertCount(1, $violations, 'Expected number of validations not found.'); - $this->assertSame('Inappropriate text.', $violations->get(0)->getMessage(), 'Incorrect constraint validation message found.'); + $this->assertEquals('Inappropriate text.', $violations->get(0)->getMessage(), 'Incorrect constraint validation message found.'); // Fix the violation and make sure it is not reported anymore. $media->setName('I love Drupal!'); @@ -341,7 +341,7 @@ /** @var \Drupal\Core\Entity\EntityConstraintViolationListInterface $violations */ $violations = $media->validate(); $this->assertCount(1, $violations, 'Expected number of validations not found.'); - $this->assertSame('Inappropriate text.', $violations->get(0)->getMessage(), 'Incorrect constraint validation message found.'); + $this->assertEquals('Inappropriate text.', $violations->get(0)->getMessage(), 'Incorrect constraint validation message found.'); // Fix the violation and make sure it is not reported anymore. $media->set('field_media_test_constraints', 'I love Drupal!'); @@ -382,7 +382,7 @@ $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->assertSame('Test source', $field->label(), 'Incorrect label is used.'); + $this->assertEquals('Test source', $field->label(), 'Incorrect label is used.'); $this->assertSame('test_type', $field->getTargetBundle(), 'Field is not targeting correct bundle.'); // Fields should be automatically saved only when creating the media type @@ -417,7 +417,7 @@ $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->assertSame('Test source with constraints', $field->label(), 'Incorrect label is used.'); + $this->assertEquals('Test source with constraints', $field->label(), 'Incorrect label is used.'); $this->assertSame('test_constraints_type', $field->getTargetBundle(), 'Field is not targeting correct bundle.'); } @@ -435,25 +435,25 @@ $source = $manager->createInstance('test', []); $source->submitConfigurationForm($form, $form_state); $expected = ['test_config_value' => 'Somewhere over the rainbow.', 'source_field' => 'field_media_test_1']; - $this->assertSame($expected, $source->getConfiguration(), 'Submitted values were saved correctly.'); + $this->assertEquals($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->assertSame($expected, $source->getConfiguration(), 'Submitted values were saved correctly.'); + $this->assertEquals($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->assertSame($expected, $source->getConfiguration(), 'Submitted values were saved correctly.'); + $this->assertEquals($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->assertSame($expected, $source->getConfiguration(), 'Submitted values were saved correctly.'); + $this->assertEquals($expected, $source->getConfiguration(), 'Submitted values were saved correctly.'); } /**