Hi!
I'm not sure, if the title describes the problem properly, so here's a better description:
#2606548: \Drupal\rest\Plugin\views\row\DataFieldRow::render should take into account the 'exclude' flag introduced a bug, which makes it impossible to use excluded fields as tokens.
Steps to reproduce:
1. Enable REST module.
2. Create a REST Export view of articles.
3. Render fields.
4. Add a title field and exclude it from display.
5. Add a Global Custom Text after it and use the token of the title, from the list of replacement patterns.
You will notice that the field doesn't display anything, so we have a basic functionality that other Display plugins support, except Rest Export.
Comment | File | Size | Author |
---|---|---|---|
#27 | interdiff.txt | 1.36 KB | dawehner |
#27 | 2717969-27.patch | 10.95 KB | dawehner |
#24 | interdiff.txt | 2.77 KB | dawehner |
#24 | 2717969-24.patch | 10.99 KB | dawehner |
#20 | interdiff.txt | 714 bytes | dawehner |
Comments
Comment #2
benelori CreditAttribution: benelori commentedComment #3
Wim LeersClarifying.
Also, 8.0.x gets no more releases, only 8.1.x and newer do.
Comment #4
benelori CreditAttribution: benelori commentedComment #5
benelori CreditAttribution: benelori commentedThe patch just moves the logic of exclusion after the rendering and it builds the render array output based on that.
Comment #6
dawehnerIn a good world we would have tests to prove that this actually fixes the issue.
I think it would be nice to keep the
!empty()
style, because why changing it.Comment #7
dawehner.
Comment #8
benelori CreditAttribution: benelori commentedAdded a Web test and used the empty() style in the actual fix.
Comment #9
benelori CreditAttribution: benelori commentedI added a new version of the patch, with some comments added to the fix.
Comment #10
dawehnerJust some small nitpicks, sorry for this small review.
Nitpick: We don't use additional whitespace
Nitpick: we don't export the UUID here usually. Let's drop it.
Comment #11
benelori CreditAttribution: benelori commentedUploaded new patch for the review at #10
Comment #13
Wim LeersRan tests locally. Indeed fails without the changes. To show to committers that this is the case, I also uploaded a tests-only patch that should fail.
I only have nitpicks, so rather than posting a review for those, I just fixed them.
Took me some time to understand the test, but after having added some debug output, I am now convinced that this test is indeed testing the thing it should be testing, and that it matches the problem description from the IS.
Comment #15
Wim LeersManually editing patches still is error prone. Hence the test-only patch in #13 failed.
Reuploading the
test-only
patch with the very first line deleted.Comment #19
Wim LeersApparently the included view is violating the Views config schema. Sadly, the output that DrupalCI provides is useless. And so is the output that
run-tests.sh
provides:Comment #20
dawehnerThere is a huge reason I personally want to get rid of run-tests.sh and all kind of other simpletest stuff: The integration with phpunit is not trivial nor well executed.
Here is the test running with the proper test runner (phpunit):
Comment #21
Wim LeersA thousand times
.Thanks, Daniel!
Comment #22
dawehnerHere is a follow up to deal with that: #2799021: Ensure a failing PHPUnit test shows enough information via run-tests.sh
Comment #23
alexpottAfaics this is all dead code.
Making this a method doesn't really add to the understandability of the test... imo the node creation should just be inlined into the setUp().
This looks super weird - if the expected JSON is not changing why wouldn't we just hardcode it. It looks like we're duplicating the logic under test in the test.
Comment #24
dawehnerI would disagree in case we would do more than those setup nodes, but there is not much more we actually do.
Good point. Its another of those instances where we copy logic we actually want to test in the test itself.
Comment #26
Wim Leers3 fails:
because the failure says:
It looks like all other views in core have
value: '1'
, notvalue: true
.Drupal\Tests\outside_in\FunctionalJavascript\OutsideInBlockFormTest
.These need to be ordered inversely according to the test output.
Comment #27
dawehnerThere we go. I went with sorting by NID as that is certainly deterministic.
Comment #28
Wim LeersYay!
Comment #29
LendudeThese modules aren't actually needed, can be removed on commit? Don't know what changes are acceptable for that...
Comment #31
LendudeUnrelated fail, see #2828045: Tests failing with unrelated „Translation: The French translation is not available”, waiting for that to go away before RTBCing again
Comment #32
LendudeBack to RTBC
Comment #34
LendudeSame unrelated fail again.
Comment #37
catchCommitted/pushed to 8.3.x and cherry-picked to 8.2.x. Thanks!