diff --git a/core/modules/file/src/Tests/FileFieldPathTest.php b/core/modules/file/src/Tests/FileFieldPathTest.php index d42922b..3b2f8d3 100644 --- a/core/modules/file/src/Tests/FileFieldPathTest.php +++ b/core/modules/file/src/Tests/FileFieldPathTest.php @@ -31,12 +31,14 @@ function testUploadPath() { // Check that the file was uploaded to the correct location. $node_storage->resetCache(array($nid)); $node = $node_storage->load($nid); - $node_file = file_load($node->{$field_name}->target_id); + /** @var \Drupal\file\FileInterface $node_file */ + $node_file = $node->{$field_name}->entity; + $date_formatter = $this->container->get('date.formatter'); $expected_filename = 'public://field/' . $field_name . '/' . - $this->container->get('date.formatter')->format(REQUEST_TIME, 'custom', 'Y') . '/' . - $this->container->get('date.formatter')->format(REQUEST_TIME, 'custom', 'm') . '/' . + $date_formatter->format(REQUEST_TIME, 'custom', 'Y') . '/' . + $date_formatter->format(REQUEST_TIME, 'custom', 'm') . '/' . $test_file->getFilename(); $this->assertPathMatch($expected_filename, $node_file->getFileUri(), format_string('The file %file was uploaded to the correct path.', array('%file' => $node_file->getFileUri())));