From f3f9f0e534dd9a623a672fa6449bbcf7b968f31f Mon Sep 17 00:00:00 2001
From: Mac_Weber <Mac_Weber@789986.no-reply.drupal.org>
Date: Mon, 28 Dec 2015 22:52:20 -0200
Subject: [PATCH] Issue #2641588 by Mac_Weber: Replace deprecated usage of
 entity_create('file') with a direct call to File::create()

---
 .../src/Tests/ContentTranslationSyncImageTest.php                  | 3 ++-
 core/modules/editor/src/Tests/EditorFileReferenceFilterTest.php    | 5 +++--
 core/modules/file/file.module                                      | 4 ++--
 core/modules/file/src/Tests/FileFieldTestBase.php                  | 2 +-
 core/modules/file/src/Tests/FileItemTest.php                       | 7 ++++---
 core/modules/file/src/Tests/FileListingTest.php                    | 2 +-
 core/modules/file/src/Tests/FileManagedTestBase.php                | 3 ++-
 core/modules/file/src/Tests/FileManagedUnitTestBase.php            | 3 ++-
 core/modules/file/src/Tests/SaveUploadTest.php                     | 2 +-
 core/modules/file/src/Tests/SpaceUsedTest.php                      | 4 +++-
 core/modules/file/src/Tests/ValidatorTest.php                      | 6 ++++--
 core/modules/file/src/Tests/Views/RelationshipUserFileDataTest.php | 3 ++-
 core/modules/hal/src/Tests/FileDenormalizeTest.php                 | 2 +-
 core/modules/hal/src/Tests/FileNormalizeTest.php                   | 4 +++-
 core/modules/image/src/Tests/FileMoveTest.php                      | 3 ++-
 core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php       | 4 ++--
 core/modules/image/src/Tests/ImageItemTest.php                     | 5 +++--
 core/modules/image/src/Tests/ImageThemeFunctionTest.php            | 3 ++-
 .../image/src/Tests/Views/RelationshipUserImageDataTest.php        | 3 ++-
 core/modules/locale/src/Tests/LocaleUpdateBase.php                 | 3 ++-
 core/modules/rdf/src/Tests/StandardProfileTest.php                 | 3 ++-
 core/modules/system/src/Tests/Entity/EntityCrudHookTest.php        | 2 +-
 core/modules/system/src/Tests/TypedData/TypedDataTest.php          | 3 ++-
 core/modules/views/src/Tests/Plugin/NumericFormatPluralTest.php    | 3 ++-
 24 files changed, 51 insertions(+), 31 deletions(-)

diff --git a/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php b/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php
index 56b1ed5..c1a458e 100644
--- a/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php
+++ b/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\content_translation\Tests;
 
 use Drupal\Core\Entity\EntityInterface;
+use Drupal\file\Entity\File;
 
 /**
  * Tests the field synchronization behavior for the image field.
@@ -137,7 +138,7 @@ function testImageFieldSync() {
         'uid' => \Drupal::currentUser()->id(),
         'status' => FILE_STATUS_PERMANENT,
       );
-      $file = entity_create('file', $field_values);
+      $file = File::create($field_values);
       $file->save();
       $fid = $file->id();
       $this->files[$index]->fid = $fid;
diff --git a/core/modules/editor/src/Tests/EditorFileReferenceFilterTest.php b/core/modules/editor/src/Tests/EditorFileReferenceFilterTest.php
index 87809ef..0a05187 100644
--- a/core/modules/editor/src/Tests/EditorFileReferenceFilterTest.php
+++ b/core/modules/editor/src/Tests/EditorFileReferenceFilterTest.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Cache\Cache;
 use Drupal\simpletest\KernelTestBase;
 use Drupal\filter\FilterPluginCollection;
+use Drupal\file\Entity\File;
 
 /**
  * Tests Editor module's file reference filter.
@@ -55,14 +56,14 @@ function testEditorFileReferenceFilter() {
     };
 
     file_put_contents('public://llama.jpg', $this->randomMachineName());
-    $image = entity_create('file', array('uri' => 'public://llama.jpg'));
+    $image = File::create(array('uri' => 'public://llama.jpg'));
     $image->save();
     $id = $image->id();
     $uuid = $image->uuid();
     $cache_tag = ['file:' . $id];
 
     file_put_contents('public://alpaca.jpg', $this->randomMachineName());
-    $image_2 = entity_create('file', array('uri' => 'public://alpaca.jpg'));
+    $image_2 = File::create(array('uri' => 'public://alpaca.jpg'));
     $image_2->save();
     $id_2 = $image_2->id();
     $uuid_2 = $image_2->uuid();
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index 08e9438..f592182 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -492,7 +492,7 @@ function file_save_data($data, $destination = NULL, $replace = FILE_EXISTS_RENAM
 
   if ($uri = file_unmanaged_save_data($data, $destination, $replace)) {
     // Create a file entity.
-    $file = entity_create('file', array(
+    $file = File::create(array(
       'uri' => $uri,
       'uid' => $user->id(),
       'status' => FILE_STATUS_PERMANENT,
@@ -767,7 +767,7 @@ function file_save_upload($form_field_name, $validators = array(), $destination
       'filesize' => $file_info->getSize(),
     );
     $values['filemime'] = \Drupal::service('file.mime_type.guesser')->guess($values['filename']);
-    $file = entity_create('file', $values);
+    $file = File::create($values);
 
     $extensions = '';
     if (isset($validators['file_validate_extensions'])) {
diff --git a/core/modules/file/src/Tests/FileFieldTestBase.php b/core/modules/file/src/Tests/FileFieldTestBase.php
index 5874cf5..60aa9b5 100644
--- a/core/modules/file/src/Tests/FileFieldTestBase.php
+++ b/core/modules/file/src/Tests/FileFieldTestBase.php
@@ -50,7 +50,7 @@ function getTestFile($type_name, $size = NULL) {
     // \Drupal\file\Entity\File::load().
     $file->filesize = filesize($file->uri);
 
-    return entity_create('file', (array) $file);
+    return File::create((array) $file);
   }
 
   /**
diff --git a/core/modules/file/src/Tests/FileItemTest.php b/core/modules/file/src/Tests/FileItemTest.php
index 9337ca0..bc27d09 100644
--- a/core/modules/file/src/Tests/FileItemTest.php
+++ b/core/modules/file/src/Tests/FileItemTest.php
@@ -12,6 +12,7 @@
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Tests\FieldUnitTestBase;
+use Drupal\file\Entity\File;
 
 /**
  * Tests using entity fields of the file field type.
@@ -61,7 +62,7 @@ protected function setUp() {
       'settings' => array('file_directory' => $this->directory),
     ))->save();
     file_put_contents('public://example.txt', $this->randomMachineName());
-    $this->file = entity_create('file', array(
+    $this->file = File::create(array(
       'uri' => 'public://example.txt',
     ));
     $this->file->save();
@@ -98,7 +99,7 @@ public function testFileItem() {
 
     // Make sure the computed files reflects updates to the file.
     file_put_contents('public://example-2.txt', $this->randomMachineName());
-    $file2 = entity_create('file', array(
+    $file2 = File::create(array(
       'uri' => 'public://example-2.txt',
     ));
     $file2->save();
@@ -123,7 +124,7 @@ public function testFileItem() {
     // Make sure the computed files reflects updates to the file.
     file_put_contents('public://example-3.txt', $this->randomMachineName());
     // Test unsaved file entity.
-    $file3 = entity_create('file', array(
+    $file3 = File::create(array(
       'uri' => 'public://example-3.txt',
     ));
     $display = entity_get_display('entity_test', 'entity_test', 'default');
diff --git a/core/modules/file/src/Tests/FileListingTest.php b/core/modules/file/src/Tests/FileListingTest.php
index 72b2378..85721f4 100644
--- a/core/modules/file/src/Tests/FileListingTest.php
+++ b/core/modules/file/src/Tests/FileListingTest.php
@@ -157,7 +157,7 @@ function testFileListingPages() {
    */
   protected function createFile() {
     // Create a new file entity.
-    $file = entity_create('file', array(
+    $file = File::create(array(
       'uid' => 1,
       'filename' => 'druplicon.txt',
       'uri' => 'public://druplicon.txt',
diff --git a/core/modules/file/src/Tests/FileManagedTestBase.php b/core/modules/file/src/Tests/FileManagedTestBase.php
index ebaaaea..df6337b 100644
--- a/core/modules/file/src/Tests/FileManagedTestBase.php
+++ b/core/modules/file/src/Tests/FileManagedTestBase.php
@@ -9,6 +9,7 @@
 
 use Drupal\file\FileInterface;
 use Drupal\simpletest\WebTestBase;
+use Drupal\file\Entity\File;
 
 /**
  * Base class for file tests that use the file_test module to test uploads and
@@ -152,7 +153,7 @@ function assertSameFile(FileInterface $file1, FileInterface $file2) {
   function createFile($filepath = NULL, $contents = NULL, $scheme = NULL) {
     // Don't count hook invocations caused by creating the file.
     \Drupal::state()->set('file_test.count_hook_invocations', FALSE);
-    $file = entity_create('file', array(
+    $file = File::create(array(
       'uri' => $this->createUri($filepath, $contents, $scheme),
       'uid' => 1,
     ));
diff --git a/core/modules/file/src/Tests/FileManagedUnitTestBase.php b/core/modules/file/src/Tests/FileManagedUnitTestBase.php
index c9f0c6b..fb42b8c 100644
--- a/core/modules/file/src/Tests/FileManagedUnitTestBase.php
+++ b/core/modules/file/src/Tests/FileManagedUnitTestBase.php
@@ -9,6 +9,7 @@
 
 use Drupal\file\FileInterface;
 use Drupal\simpletest\KernelTestBase;
+use Drupal\file\Entity\File;
 
 /**
  * Base class for file unit tests that use the file_test module to test uploads and
@@ -164,7 +165,7 @@ function assertSameFile(FileInterface $file1, FileInterface $file2) {
   function createFile($filepath = NULL, $contents = NULL, $scheme = NULL) {
     // Don't count hook invocations caused by creating the file.
     \Drupal::state()->set('file_test.count_hook_invocations', FALSE);
-    $file = entity_create('file', array(
+    $file = File::create(array(
       'uri' => $this->createUri($filepath, $contents, $scheme),
       'uid' => 1,
     ));
diff --git a/core/modules/file/src/Tests/SaveUploadTest.php b/core/modules/file/src/Tests/SaveUploadTest.php
index 7c3bd4c..9b6a090 100644
--- a/core/modules/file/src/Tests/SaveUploadTest.php
+++ b/core/modules/file/src/Tests/SaveUploadTest.php
@@ -52,7 +52,7 @@ protected function setUp() {
     $this->drupalLogin($account);
 
     $image_files = $this->drupalGetTestFiles('image');
-    $this->image = entity_create('file', (array) current($image_files));
+    $this->image = File::create((array) current($image_files));
 
     list(, $this->imageExtension) = explode('.', $this->image->getFilename());
     $this->assertTrue(is_file($this->image->getFileUri()), "The image file we're going to upload exists.");
diff --git a/core/modules/file/src/Tests/SpaceUsedTest.php b/core/modules/file/src/Tests/SpaceUsedTest.php
index 56ed974..11ea726 100644
--- a/core/modules/file/src/Tests/SpaceUsedTest.php
+++ b/core/modules/file/src/Tests/SpaceUsedTest.php
@@ -7,6 +7,8 @@
 
 namespace Drupal\file\Tests;
 
+use Drupal\file\Entity\File;
+
 /**
  * Tests the spaceUsed() function.
  *
@@ -44,7 +46,7 @@ protected function setUp() {
    */
   protected function createFileWithSize($uri, $size, $uid, $status = FILE_STATUS_PERMANENT) {
     file_put_contents($uri, $this->randomMachineName($size));
-    $file = entity_create('file', array(
+    $file = File::create(array(
       'uri' => $uri,
       'uid' => $uid,
       'status' => $status,
diff --git a/core/modules/file/src/Tests/ValidatorTest.php b/core/modules/file/src/Tests/ValidatorTest.php
index 8ad5939..e9c0066 100644
--- a/core/modules/file/src/Tests/ValidatorTest.php
+++ b/core/modules/file/src/Tests/ValidatorTest.php
@@ -7,6 +7,8 @@
 
 namespace Drupal\file\Tests;
 
+use Drupal\file\Entity\File;
+
 /**
  * Tests the functions used to validate uploaded files.
  *
@@ -44,7 +46,7 @@ protected function setUp() {
    * Test the file_validate_extensions() function.
    */
   function testFileValidateExtensions() {
-    $file = entity_create('file', array('filename' => 'asdf.txt'));
+    $file = File::create(array('filename' => 'asdf.txt'));
     $errors = file_validate_extensions($file, 'asdf txt pork');
     $this->assertEqual(count($errors), 0, 'Valid extension accepted.', 'File');
 
@@ -145,7 +147,7 @@ function testFileValidateNameLength() {
    */
   function testFileValidateSize() {
     // Create a file with a size of 1000 bytes, and quotas of only 1 byte.
-    $file = entity_create('file', array('filesize' => 1000));
+    $file = File::create(array('filesize' => 1000));
     $errors = file_validate_size($file, 0, 0);
     $this->assertEqual(count($errors), 0, 'No limits means no errors.', 'File');
     $errors = file_validate_size($file, 1, 0);
diff --git a/core/modules/file/src/Tests/Views/RelationshipUserFileDataTest.php b/core/modules/file/src/Tests/Views/RelationshipUserFileDataTest.php
index 8cdc903..7a067f2 100644
--- a/core/modules/file/src/Tests/Views/RelationshipUserFileDataTest.php
+++ b/core/modules/file/src/Tests/Views/RelationshipUserFileDataTest.php
@@ -10,6 +10,7 @@
 use Drupal\views\Tests\ViewTestBase;
 use Drupal\views\Views;
 use Drupal\views\Tests\ViewTestData;
+use Drupal\file\Entity\File;
 
 /**
  * Tests file on user relationship handler.
@@ -58,7 +59,7 @@ protected function setUp() {
    * Tests using the views file relationship.
    */
   public function testViewsHandlerRelationshipUserFileData() {
-    $file = entity_create('file', array(
+    $file = File::create(array(
       'fid' => 2,
       'uid' => 2,
       'filename' => 'image-test.jpg',
diff --git a/core/modules/hal/src/Tests/FileDenormalizeTest.php b/core/modules/hal/src/Tests/FileDenormalizeTest.php
index 853b06d..b2e6ab5 100644
--- a/core/modules/hal/src/Tests/FileDenormalizeTest.php
+++ b/core/modules/hal/src/Tests/FileDenormalizeTest.php
@@ -36,7 +36,7 @@ public function testFileDenormalize() {
       'status' => FILE_STATUS_PERMANENT,
     );
     // Create a new file entity.
-    $file = entity_create('file', $file_params);
+    $file = File::create($file_params);
     file_put_contents($file->getFileUri(), 'hello world');
     $file->save();
 
diff --git a/core/modules/hal/src/Tests/FileNormalizeTest.php b/core/modules/hal/src/Tests/FileNormalizeTest.php
index 64ffd07..cc86444 100644
--- a/core/modules/hal/src/Tests/FileNormalizeTest.php
+++ b/core/modules/hal/src/Tests/FileNormalizeTest.php
@@ -7,6 +7,8 @@
 
 namespace Drupal\hal\Tests;
 
+use Drupal\file\Entity\File;
+
 use Drupal\Core\Cache\MemoryBackend;
 use Drupal\hal\Encoder\JsonEncoder;
 use Drupal\hal\Normalizer\FieldItemNormalizer;
@@ -65,7 +67,7 @@ public function testNormalize() {
       'status' => FILE_STATUS_PERMANENT,
     );
     // Create a new file entity.
-    $file = entity_create('file', $file_params);
+    $file = File::create($file_params);
     file_put_contents($file->getFileUri(), 'hello world');
     $file->save();
 
diff --git a/core/modules/image/src/Tests/FileMoveTest.php b/core/modules/image/src/Tests/FileMoveTest.php
index 34c54a7..b2be12f 100644
--- a/core/modules/image/src/Tests/FileMoveTest.php
+++ b/core/modules/image/src/Tests/FileMoveTest.php
@@ -9,6 +9,7 @@
 
 use Drupal\simpletest\WebTestBase;
 use Drupal\image\Entity\ImageStyle;
+use Drupal\file\Entity\File;
 
 /**
  * Tests the file move function for images and image styles.
@@ -29,7 +30,7 @@ class FileMoveTest extends WebTestBase {
    */
   function testNormal() {
     // Pick a file for testing.
-    $file = entity_create('file', (array) current($this->drupalGetTestFiles('image')));
+    $file = File::create((array) current($this->drupalGetTestFiles('image')));
 
     // Create derivative image.
     $styles = ImageStyle::loadMultiple();
diff --git a/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php b/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php
index c33ca1e..2cedca0 100644
--- a/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php
+++ b/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php
@@ -35,12 +35,12 @@ public function testDefaultImages() {
       $filename = $this->randomMachineName() . "$i";
       $desired_filepath = 'public://' . $filename;
       file_unmanaged_copy($files[0]->uri, $desired_filepath, FILE_EXISTS_ERROR);
-      $file = entity_create('file', array('uri' => $desired_filepath, 'filename' => $filename, 'name' => $filename));
+      $file = File::create(array('uri' => $desired_filepath, 'filename' => $filename, 'name' => $filename));
       $file->save();
     }
     $default_images = array();
     foreach (array('field', 'field', 'field2', 'field_new', 'field_new') as $image_target) {
-      $file = entity_create('file', (array) array_pop($files));
+      $file = File::create((array) array_pop($files));
       $file->save();
       $default_images[$image_target] = $file;
     }
diff --git a/core/modules/image/src/Tests/ImageItemTest.php b/core/modules/image/src/Tests/ImageItemTest.php
index fddbd3f..40e1baa 100644
--- a/core/modules/image/src/Tests/ImageItemTest.php
+++ b/core/modules/image/src/Tests/ImageItemTest.php
@@ -11,6 +11,7 @@
 use Drupal\Core\Field\FieldItemListInterface;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\field\Tests\FieldUnitTestBase;
+use Drupal\file\Entity\File;
 
 /**
  * Tests using entity fields of the image field type.
@@ -56,7 +57,7 @@ protected function setUp() {
       'bundle' => 'entity_test',
     ))->save();
     file_unmanaged_copy(\Drupal::root() . '/core/misc/druplicon.png', 'public://example.jpg');
-    $this->image = entity_create('file', array(
+    $this->image = File::create(array(
       'uri' => 'public://example.jpg',
     ));
     $this->image->save();
@@ -89,7 +90,7 @@ public function testImageItem() {
 
     // Make sure the computed entity reflects updates to the referenced file.
     file_unmanaged_copy(\Drupal::root() . '/core/misc/druplicon.png', 'public://example-2.jpg');
-    $image2 = entity_create('file', array(
+    $image2 = File::create(array(
       'uri' => 'public://example-2.jpg',
     ));
     $image2->save();
diff --git a/core/modules/image/src/Tests/ImageThemeFunctionTest.php b/core/modules/image/src/Tests/ImageThemeFunctionTest.php
index 54b471b..5ead39f 100644
--- a/core/modules/image/src/Tests/ImageThemeFunctionTest.php
+++ b/core/modules/image/src/Tests/ImageThemeFunctionTest.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\Core\Url;
 use Drupal\simpletest\WebTestBase;
+use Drupal\file\Entity\File;
 
 /**
  * Tests image theme functions.
@@ -52,7 +53,7 @@ protected function setUp() {
       'bundle' => 'entity_test',
     ))->save();
     file_unmanaged_copy(\Drupal::root() . '/core/misc/druplicon.png', 'public://example.jpg');
-    $this->image = entity_create('file', array(
+    $this->image = File::create(array(
       'uri' => 'public://example.jpg',
     ));
     $this->image->save();
diff --git a/core/modules/image/src/Tests/Views/RelationshipUserImageDataTest.php b/core/modules/image/src/Tests/Views/RelationshipUserImageDataTest.php
index 4ef0626..a26c1bb 100644
--- a/core/modules/image/src/Tests/Views/RelationshipUserImageDataTest.php
+++ b/core/modules/image/src/Tests/Views/RelationshipUserImageDataTest.php
@@ -10,6 +10,7 @@
 use Drupal\views\Tests\ViewTestBase;
 use Drupal\views\Views;
 use Drupal\views\Tests\ViewTestData;
+use Drupal\file\Entity\File;
 
 /**
  * Tests image on user relationship handler.
@@ -58,7 +59,7 @@ protected function setUp() {
    * Tests using the views image relationship.
    */
   public function testViewsHandlerRelationshipUserImageData() {
-    $file = entity_create('file', array(
+    $file = File::create(array(
       'fid' => 2,
       'uid' => 2,
       'filename' => 'image-test.jpg',
diff --git a/core/modules/locale/src/Tests/LocaleUpdateBase.php b/core/modules/locale/src/Tests/LocaleUpdateBase.php
index cc2aed3..c694f5e 100644
--- a/core/modules/locale/src/Tests/LocaleUpdateBase.php
+++ b/core/modules/locale/src/Tests/LocaleUpdateBase.php
@@ -10,6 +10,7 @@
 use Drupal\Core\StreamWrapper\PublicStream;
 use Drupal\simpletest\WebTestBase;
 use Drupal\Component\Utility\SafeMarkup;
+use Drupal\file\Entity\File;
 
 /**
  * Base class for testing updates to string translations.
@@ -133,7 +134,7 @@ protected function makePoFile($path, $filename, $timestamp = NULL, array $transl
     }
 
     file_prepare_directory($path, FILE_CREATE_DIRECTORY);
-    $file = entity_create('file', array(
+    $file = File::create(array(
       'uid' => 1,
       'filename' => $filename,
       'uri' => $path . '/' . $filename,
diff --git a/core/modules/rdf/src/Tests/StandardProfileTest.php b/core/modules/rdf/src/Tests/StandardProfileTest.php
index 57f4c3f..79147d3 100644
--- a/core/modules/rdf/src/Tests/StandardProfileTest.php
+++ b/core/modules/rdf/src/Tests/StandardProfileTest.php
@@ -12,6 +12,7 @@
 use Drupal\node\Entity\NodeType;
 use Drupal\node\NodeInterface;
 use Drupal\simpletest\WebTestBase;
+use Drupal\file\Entity\File;
 
 /**
  * Tests the RDF mappings and RDFa markup of the standard profile.
@@ -139,7 +140,7 @@ protected function setUp() {
 
     // Create image.
     file_unmanaged_copy(\Drupal::root() . '/core/misc/druplicon.png', 'public://example.jpg');
-    $this->image = entity_create('file', array('uri' => 'public://example.jpg'));
+    $this->image = File::create(array('uri' => 'public://example.jpg'));
     $this->image->save();
 
     // Create article.
diff --git a/core/modules/system/src/Tests/Entity/EntityCrudHookTest.php b/core/modules/system/src/Tests/Entity/EntityCrudHookTest.php
index 2885d47..1c76274 100644
--- a/core/modules/system/src/Tests/Entity/EntityCrudHookTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityCrudHookTest.php
@@ -230,7 +230,7 @@ public function testFileHooks() {
 
     $url = 'public://entity_crud_hook_test.file';
     file_put_contents($url, 'Test test test');
-    $file = entity_create('file', array(
+    $file = File::create(array(
       'fid' => NULL,
       'uid' => 1,
       'filename' => 'entity_crud_hook_test.file',
diff --git a/core/modules/system/src/Tests/TypedData/TypedDataTest.php b/core/modules/system/src/Tests/TypedData/TypedDataTest.php
index c6a7f1c..9b1b3c5 100644
--- a/core/modules/system/src/Tests/TypedData/TypedDataTest.php
+++ b/core/modules/system/src/Tests/TypedData/TypedDataTest.php
@@ -14,6 +14,7 @@
 use Drupal\Core\TypedData\TypedDataInterface;
 use Drupal\simpletest\KernelTestBase;
 use Drupal\Core\Datetime\DrupalDateTime;
+use Drupal\file\Entity\File;
 
 /**
  * Tests the functionality of all core data types.
@@ -247,7 +248,7 @@ public function testGetAndSet() {
     for ($i = 0; $i < 3; $i++){
       $path = "public://example_$i.png";
       file_unmanaged_copy(\Drupal::root() . '/core/misc/druplicon.png', $path);
-      $image = entity_create('file', array('uri' => $path));
+      $image = File::create(array('uri' => $path));
       $image->save();
       $files[] = $image;
     }
diff --git a/core/modules/views/src/Tests/Plugin/NumericFormatPluralTest.php b/core/modules/views/src/Tests/Plugin/NumericFormatPluralTest.php
index 8e75e4d..097d2e5 100644
--- a/core/modules/views/src/Tests/Plugin/NumericFormatPluralTest.php
+++ b/core/modules/views/src/Tests/Plugin/NumericFormatPluralTest.php
@@ -9,6 +9,7 @@
 
 use Drupal\Component\Gettext\PoHeader;
 use Drupal\views\Tests\ViewTestBase;
+use Drupal\file\Entity\File;
 
 /**
  * Tests the creation of numeric fields.
@@ -144,7 +145,7 @@ function testNumericFormatPlural() {
    */
   protected function createFile() {
     // Create a new file entity.
-    $file = entity_create('file', array(
+    $file = File::create(array(
       'uid' => 1,
       'filename' => 'druplicon.txt',
       'uri' => 'public://druplicon.txt',
-- 
2.1.4

