Closed (fixed)
Project:
Drupal core
Version:
8.2.x-dev
Component:
entity system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
1 Mar 2016 at 23:48 UTC
Updated:
22 Mar 2016 at 14:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
berdirComment #3
berdirThis fixes a lot of "Indirect modification of overloaded property Drupal\KernelTests\Core\Entity\EntityTranslationTest::$field has no effect"
Also, assertEqual() in simpletest aparently things that [] == NULL. assertEquals() does not.
Previous patch was messed up, sorry.
Comment #6
berdirForgot to fix the field tests.
Comment #7
dawehnerGreat work!
IMHO we should fix this is KernelTestBase::assertEquals instead
Comment #9
berdirA few more conversions. FieldSettingsTest is failing. Whatever that test is trying to do, it doesn't work the way it thinks:
I think assertEqual() in simpletest doesn't check types of nested array elements and phpunit does. I'm not sure if it wanted to test that the string is converted to a boolean but it doesn't work. After saving, the original object is kept. And even reloading, as I tried, doesn't make it work as then it's replaced again.
Comment #10
berdirThis is what I get before making changes:
And after my changes:
Comment #12
dawehnerIn my debugging this seems to be really caused by
\Drupal\field_test\Plugin\Field\FieldType\TestItem::fieldSettingsFromConfigDatabelieving in runtime casting after loading, which of course doesn't exist.Comment #13
berdirYeah, I'm just updating the test to look for a string now. Also commented in #2236903: setSettings() on field definitions can unintentionally clear default values
Also fixed another test fail, tried to enable the same module twice. And fixed the namespace of the filter test moved that incorectly.
Comment #14
tim.plunkettIs this in scope?
These changes look wrong, or at least some of them.
Out of scope
This seems like it should be able to stay as a Boolean, is there a fix needed elsewhere?
Comment #15
dawehnerWell, they are needed in order to let phpunit not complain about it.
We debugged that earlier ... simpletest relied on casting 'TRUE' to TRUE, internally. The test though should actually expect that, see
\Drupal\field_test\Plugin\Field\FieldType\TestItem::fieldSettingsFromConfigDataComment #17
tim.plunkettI'm not sure about this being 8.1.x or 8.2.x, leaving here for now.
Duh, good point about
@covers \Drupal\field\Entity\FieldStorageConfig::getSettingsLooks great!
Comment #18
dawehnerThank you tim!
Comment #19
alexpottCommitted c3f14f9 and pushed to 8.1.x and 8.2.x. Thanks!
As this is test only code I've committed to 8.1.x. Not cherry-picking to 8.0.x because it feels like unnecessary disruption to the production branch this late in its life cycle.
Comment #21
amateescu commentedOpened an issue to backport the new test class to 8.0.x: #2683391: Backport EntityKernelTestBase to 8.0.x