Closed (fixed)
Project:
Drupal core
Version:
8.4.x-dev
Component:
views.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
9 Nov 2017 at 22:44 UTC
Updated:
11 Dec 2017 at 11:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
amateescu commentedVery simple patch.
I'm not sure where we can add a test for this, so pinging @dawehner for help..
Comment #3
amateescu commentedForgot to actually ping Daniel.
Comment #4
dawehnerWe are already doing stringcasting in all the other cases, so +1 to add it here too!
I can't think of a really good place to add a test for that. The "best" place I was able to find is somewhere in
\Drupal\Tests\views\Kernel\Handler\FieldFieldTest. Given that it might be worth writing a custom test class for\Drupal\views\Tests\ViewResultAssertionTrait.Comment #5
amateescu commentedI finally figured out the problem! When we load entities from the storage, its field values are strings. However, if we change the values to be something else (e.g. integers or booleans) in a
hook_entity_load()for example, that's whenassertIdenticalResultsetHelper()breaks without the explicit string casting from #2.Comment #7
dawehnerI've been having the same issue before on some rest issue. Saving and loading an entity isn't producing the exact same types sadly.
The tests looks as expected for me.
I think we should add an explanation here
Comment #8
amateescu commentedWe were already explaining it a few lines above, just the code was not really doing what the comment was saying :)
Maybe it will be cleaner if we move the comment down a bit?
Comment #9
dawehner+1. Thank you @amateescu!
Comment #10
amateescu commentedYay, thanks for reviewing again @dawehner :) I forgot to unassign you after the initial feedback..
Comment #13
catch