diff --git a/core/modules/file/src/Tests/FileFieldRevisionTest.php b/core/modules/file/src/Tests/FileFieldRevisionTest.php index 5ab53f0..a276715 100644 --- a/core/modules/file/src/Tests/FileFieldRevisionTest.php +++ b/core/modules/file/src/Tests/FileFieldRevisionTest.php @@ -145,7 +145,8 @@ function testRevisions() { * Every entity revision referencing different file. */ public function testDeleteEntityWithMultipleRevisions() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + /** @var \Drupal\node\NodeStorageInterface $node_storage */ + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $type_name = 'article'; $field_name = strtolower($this->randomMachineName()); @@ -157,17 +158,17 @@ public function testDeleteEntityWithMultipleRevisions() { $nid = $this->uploadNodeFile($test_file, $field_name, $type_name); // Check that the file exists on disk and in the database. - $node_storage->resetCache(array($nid)); + $node_storage->resetCache([$nid]); $node = $node_storage->load($nid); $node_file_r1 = File::load($node->{$field_name}->target_id); // Upload another file to the same node in a new revision. $this->replaceNodeFile($test_file, $field_name, $nid); - $node_storage->resetCache(array($nid)); + $node_storage->resetCache([$nid]); $node = $node_storage->load($nid); $node_file_r2 = File::load($node->{$field_name}->target_id); - // Check files from both revisions of Entity. + // Check that files from both revisions exists as permanent managed files. $this->assertFileExists($node_file_r1, 'New file saved to disk on node creation.'); $this->assertFileEntryExists($node_file_r1, 'File entry exists in database on node creation.'); $this->assertFileIsPermanent($node_file_r1, 'File is permanent.'); @@ -177,17 +178,16 @@ public function testDeleteEntityWithMultipleRevisions() { $this->assertFileIsPermanent($node_file_r2, 'Replacement file is permanent.'); // Delete entire Entity. - $node_storage->delete(array($node)); + $node_storage->delete([$node]); // Execute crons related to files. - db_update('file_managed') - ->fields(array( - 'changed' => REQUEST_TIME - ($this->config('system.file') - ->get('temporary_maximum_age') + 1), - )) - ->condition('fid', array($node_file_r1->id(), $node_file_r2->id()), 'IN') + $this->container->get('database')->update('file_managed') + ->fields([ + 'changed' => REQUEST_TIME - ($this->config('system.file')->get('temporary_maximum_age') + 1), + ]) + ->condition('fid', [$node_file_r1->id(), $node_file_r2->id()], 'IN') ->execute(); - \Drupal::service('cron')->run(); + $this->container->get('cron')->run(); // Check data integrity, both files should be removed. $this->assertFileNotExists($node_file_r1, 'File from non-active revision is deleted from disk.');