diff --git a/core/modules/file/tests/src/Kernel/FileUriItemTest.php b/core/modules/file/tests/src/Kernel/FileUriItemTest.php index 5c38fa6441..ed16caab2a 100644 --- a/core/modules/file/tests/src/Kernel/FileUriItemTest.php +++ b/core/modules/file/tests/src/Kernel/FileUriItemTest.php @@ -1,6 +1,7 @@ save(); $this->assertSame($uri, $file->uri->value); - $this->assertSame(file_url_transform_relative(file_create_url($uri), $file->uri->url)); + $this->assertSame(file_url_transform_relative(file_create_url($uri)), $file->uri->url); } } diff --git a/core/modules/file/tests/src/Unit/FileUrlTest.php b/core/modules/file/tests/src/Unit/FileUrlTest.php index 93360a0b48..2c3c2ba993 100644 --- a/core/modules/file/tests/src/Unit/FileUrlTest.php +++ b/core/modules/file/tests/src/Unit/FileUrlTest.php @@ -6,14 +6,14 @@ use Drupal\Core\TypedData\DataDefinitionInterface; use Drupal\file\FileInterface; use Drupal\file\FileUrl; -use Drupal\Tests\UnitTestCase; +use Drupal\KernelTests\KernelTestBase; /** * @coversDefaultClass \Drupal\file\FileUrl * * @group file */ -class FileUrlTest extends UnitTestCase { +class FileUrlTest extends KernelTestBase { /** * The test URL to use. @@ -39,10 +39,12 @@ public function testGetValue() { $typed_data = new FileUrl($definition->reveal(), 'test', $parent->reveal()); - $this->assertSame('/path/to/file.txt', $typed_data->getValue()); + $expected = file_url_transform_relative(file_create_url($this->testUrl)); + + $this->assertSame($expected, $typed_data->getValue()); // Do this a second time to confirm the same value is returned but the value // isn't retrieved from the parent entity again. - $this->assertSame('/path/to/file.txt', $typed_data->getValue()); + $this->assertSame($expected, $typed_data->getValue()); } /**