Problem/Motivation

Changing a node type label does not update the entity bundle list/cache.

Proposed resolution

Add a cache clear call.

Remaining tasks

Tests. Possibly update that part of the code to use non-deprecated methods.

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir created an issue. See original summary.

dawehner’s picture

I'm wondering whether we could provide some form of test coverage for that?

aspilicious’s picture

Just create a page that prints all the bundles names, change the name and verify it isn't changed on that page.

Or is that to much?

Berdir’s picture

Issue tags: +Needs tests

A kernel test should work fine too, just need to change the name of a node type, save and then check getBundleInfo() and make sure it was updated.

aspilicious’s picture

Assigned: Unassigned » aspilicious

I'm going to try to add a test to the existing testbase.

aspilicious’s picture

Or my test is incorrect or the patch doesn't work.

Berdir’s picture

You're mixing web requests and accessing that information within the test. There's a populated static cache that can't know that you just invalidated things in some form submission.

You need a test that saves a node type through the API or also check this over a request, not mix it.

aspilicious’s picture

Apparently I can't figure out how to get this test working

    // Change the name through the API
    $page_type = NodeType::load('page');
    $page_type->name = 'NewBar';
    $page_type->save();

    /** @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface $bundle_info */
    $bundle_info = \Drupal::service('entity_type.bundle.info');
    $node_bundles = $bundle_info->getBundleInfo('node');
    $this->assertText($node_bundles['page']['label'], 'NewBar', 'Node type bundle cache is updated');

Loops in simpletest

aspilicious’s picture

The last submitted patch, 6: 2617590-config-entity-bundle-base-update-cache-6.patch, failed testing.

swentel’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests

Looks good to me

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Looks good to me too. Committed c41548e and pushed to 8.0.x and 8.1.x. Thanks!

  • alexpott committed dffb305 on 8.1.x
    Issue #2617590 by aspilicious, Berdir: ConfigEntityBundleBase needs to...

  • alexpott committed c41548e on
    Issue #2617590 by aspilicious, Berdir: ConfigEntityBundleBase needs to...

Status: Fixed » Closed (fixed)

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