Problem/Motivation

NormalizerTestBase extends a deprecated class, and calls deprecated methods. It'd set a better example if it didn't do this.

Proposed resolution

Extend the newer class and call services rather than functions.

Remaining tasks

Review / commit

User interface changes

None

API changes

None

Data model changes

None

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

timmillwood created an issue. See original summary.

timmillwood’s picture

Status: Needs work » Needs review
FileSize
1.22 KB
dixon_’s picture

Status: Needs review » Reviewed & tested by the community

Looks a lot better like this indeed.

dawehner’s picture

+++ b/core/modules/serialization/src/Tests/NormalizerTestBase.php
@@ -29,14 +29,18 @@ protected function setUp() {
+    \Drupal::entityManager()
+        ->getStorage('field_storage_config')
+        ->create(array(
       'entity_type' => 'entity_test_mulrev',
       'field_name' => 'field_test_text',
       'type' => 'text',
       'cardinality' => 1,
       'translatable' => FALSE,
     ))->save();
-    entity_create('field_config', array(
+    \Drupal::entityManager()
+        ->getStorage('field_config')
+        ->create(array(

Is there a reason we don't use FieldstorageConfig::create() and FieldConfig::create() IMHO those variants are way easier to read

timmillwood’s picture

Taking onboard comments in #4.

dawehner’s picture

Issue tags: +rc eligible

Nice, thank you!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 5: removing_deprecated-2609904-5.patch, failed testing.

timmillwood’s picture

Status: Needs work » Needs review
FileSize
1.18 KB

Adding missing colon.

timmillwood’s picture

Status: Needs review » Reviewed & tested by the community

Moving back to RTBC

xjm’s picture

Title: Removing deprecated functions from NormalizerTestBase » Replace deprecated entity_create() calls in NormalizerTestBase
Status: Reviewed & tested by the community » Fixed

So, there are still 905 calls to entity_create() in core, plus some other references.

This patch is fine and totally RC eligible as test-only changes, so I'm going to go ahead and commit it. However, we should do subsequent replacements for entity_create() on a per-entity-type basis throughout core (child issues of #2490966: [Meta] Replace deprecated usage of entity_create with a direct call to the entity type class).

Committed and pushed to 8.0.x. Thanks!

  • xjm committed 1022684 on 8.0.x
    Issue #2609904 by timmillwood, dawehner: Replace deprecated...

  • xjm committed 1022684 on 8.1.x
    Issue #2609904 by timmillwood, dawehner: Replace deprecated...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.