Closed (fixed)
Project:
Drupal core
Version:
8.2.x-dev
Component:
entity system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
30 Jun 2016 at 12:31 UTC
Updated:
10 Nov 2016 at 15:21 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
kamalrajsahu21 commentedComment #3
kamalrajsahu21 commentedHere is the patch. Please review and commit.
Comment #4
kamalrajsahu21 commentedComment #5
tstoecklerThat looks's perfect, thanks!
Can you add a quick test to
EntityTypeTest? There's already atestGetStorageClass()so maybe we can add a littletestSetStorageClass()below it.Comment #6
leolandotan commentedI'll try to work on this.
Comment #7
leolandotan commentedHere I have added a simple test method for the `setStorageClass` method.
Hope everything is in order.
Comment #9
eporama commentedThe issue here is that
setStorageClassis now returning a full entityType object, not just the name of the storage class itself.Also, since handlers is a private method of entityType, you can't call it here. So we have to use
getStorageClass(which isgetHanderClass('storage')). However, getHandlerClass has a check to make sure the class is defined, we can't test with just concatenating "NewTest" on the name of the class because then getHandlerClass returns null.You can, however, set up the entity with a null storage class and then change it to the
$controllerclass.Comment #11
eporama commentedJust FYI, looks like this failure is not specifically in this new patch, but due to #2749955: Random fails in UpdatePathTestBase tests. Will hold off on retesting until that is resolved.
Comment #13
eporama commentedRequeueing the test in #9 as the random failures appear to have been accounted for.
Comment #14
larowlanLooking good - comments follow
You need to test what you're actually fixing.
Comment #15
eporama commentedRight. New test does check to make sure that what we're getting back is
$this.Do we need any kind of testing that setStorageClass is actually setting a storage class? That was more what the original test was attempting, but not what this issue was fixing.
Comment #16
claudiu.cristeaThat seems to be covered by
EntityTypeTest::testGetStorageClass().Looks good to go.
Comment #18
xjmCommitted 24d528d and pushed to 8.3.x. Thanks!
Comment #19
tstoecklerThanks all, great to see this fixed!
I hadn't noticed this has been auto-moved to 8.3.x but as a bug fix, this should go into 8.2.x as well, so re-opening for that.
Comment #21
tstoecklerSent for a test run on 8.2.x now (and accidentally retested on 8.3.x, oops...)
Comment #23
tstoecklerComment #24
xjmWell, this changes the return value of the implementation (to match the interface), so it does have the teeniest bit of potential disruption.
However, it's very theoretical and unlikely that something could possibly rely on this implementation returning NULL, so I think it is fine to backport while we are still in beta. (I would not during RC or in a patch release, since
EntityTypeis an important base class.)Thanks @tstoeckler!
Comment #27
rangana commented