Problem/Motivation

EntityTestTest and FieldResolverTest are currently failing because of #2976035: Entity type CRUD operations must use the last installed entity type and field storage definitions .

Proposed resolution

Fix them.

Remaining tasks

Review.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andypost created an issue. See original summary.

andypost’s picture

Looks mostly that enough

amateescu [8:17 PM]
you should take a look at the patch that was committed as well, because we have a test in core for switching the storage of the contact message entity type (edited)
the approach for that had to be changed so it might be very relevant to those test fails (edited)
@andypost specifically, I'm talking about `contact_storage_test_install()` from core

Status: Needs review » Needs work

The last submitted patch, 2: 3038668-2.patch, failed testing. View results

andypost’s picture

Status: Needs work » Needs review
FileSize
3.7 KB

something weird in tests

Status: Needs review » Needs work

The last submitted patch, 4: 3038668-4.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

andypost’s picture

andypost’s picture

Looks core's testing module has collision now after its removal extra deprecations shown

Remaining deprecation notices (10)

  4x: drupal_set_message() is deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead. See https://www.drupal.org/node/2774931
    4x in ContactStorageTest::testContactStorage from Drupal\Tests\contact_storage\Functional

  2x: Passing the entity.manager service to ContentEntityForm::__construct() is deprecated in Drupal 8.6.0 and will be removed before Drupal 9.0.0. Pass the entity.repository service instead. See https://www.drupal.org/node/2549139.
    2x in ContactStorageTest::testContactStorage from Drupal\Tests\contact_storage\Functional

  2x: EntityManagerInterface::getTranslationFromContext() is deprecated in 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\Entity\EntityRepository::getTranslationFromContext() instead. See https://www.drupal.org/node/2549139.
    2x in ContactStorageTest::testContactStorage from Drupal\Tests\contact_storage\Functional

  2x: EntityInterface::link() is deprecated in Drupal 8.0.0 and will be removed in Drupal 9.0.0. EntityInterface::toLink() instead. Note, the default relationship for configuration entities changes from 'edit-form' to 'canonical'. See https://www.drupal.org/node/2614344
    2x in ContactStorageTest::testContactStorage from Drupal\Tests\contact_storage\Functional

Status: Needs review » Needs work

The last submitted patch, 7: 3038668-7.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

andypost’s picture

andypost’s picture

andypost’s picture

Status: Needs work » Needs review

I think that's compatible with >=8.5 at least

andypost’s picture

andypost’s picture

I bet it because order of modules so hook_entity_type_alter() of test module fire last

jibran’s picture

jibran’s picture

FileSize
1.61 KB
2.33 KB

Ignore last patch. Interdiff is from #10.

Status: Needs review » Needs work

The last submitted patch, 15: 3038668-15.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

jibran’s picture

Status: Needs work » Needs review
FileSize
771 bytes
2.32 KB
Berdir’s picture

Why uninstall + install and not just update? Is that not working?

jibran’s picture

I had the same question. I think it was not fieldable before and after this change, it is but let me try that. Install is the copy of contact_storage_test_install from core.

jibran’s picture

Status: Needs review » Needs work

The last submitted patch, 20: 3038668-20.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

jibran’s picture

Status: Needs work » Needs review

As I suspected in private chat with @andypost

it is because of

// If shared table schema changes are needed, we can't proceed.
    if (!class_exists($original->getStorageClass()) || $this->hasSharedTableStructureChange($entity_type, $original)) {
      throw new EntityStorageException('It is not possible to change the entity type schema outside of a batch context. Use EntityDefinitionUpdateManagerInterface::updateFieldableEntityType() instead.');
    }

in \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::onEntityTypeUpdate()

Berdir’s picture

That's pretty weird though, because in this case, we change from null storage to having a storage, but I guess that's not possible to detect unless it that storage class is hardcoded there..

andypost’s picture

So it still can't run with core's testing module enabled(

jibran’s picture

Let's try this.

Status: Needs review » Needs work

The last submitted patch, 25: 3038668-25.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

amateescu’s picture

That's pretty weird though, because in this case, we change from null storage to having a storage, but I guess that's not possible to detect unless it that storage class is hardcoded there..

Yup, that's the problem :)

However, why do we need this test to install the contact_storage_test module from core, when #17 passed all tests?

Berdir’s picture

Status: Needs work » Reviewed & tested by the community

I have no idea, I think that was an accidental copy & paste, that line has been part of the very first commit of that test, which one students worked on, and I'm sure it was started based on a copy of the core test.

Let's just commit #17, this is fine.

  • larowlan committed c14dad7 on 8.x-1.x authored by jibran
    Issue #3038668 by jibran, andypost, Berdir, amateescu: Fix tests...
larowlan’s picture

Status: Reviewed & tested by the community » Fixed

thanks folks

andypost’s picture

phenaproxima’s picture

In my cursory manual testing (as part of Lightning development, since this module is used by Lightning Core), I discovered that this module cannot be installed on Drupal 8.7 without this fix. Any chance of a new release being rolled?

mpotter’s picture

A release is really needed. Using this as part of lightning and tried to add the patch in #17 or #25 to my composer.json and just get

[ErrorException]
Array to string conversion

when running composer install (error is from composer-patches). Other patches (like in drupal/core) work so not sure what composer's problem is with this. But being able to just update the module version instead of patching would be much nicer.

Berdir’s picture

That error typically happens if the same patch is included twice, it is possible that lightning itself already includes it?

Status: Fixed » Closed (fixed)

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