Problem/Motivation
+++ b/core/modules/user/config/schema/user.views.schema.yml @@ -56,10 +56,6 @@ views.argument_default.current_user: -views.argument_default.node: - type: boolean - label: 'Content ID from URL' -Let's get a follow up to add a specific test for this then. Nice to have it fixed though.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | test-node-argument_default-plugin-2660446-14.patch | 9.47 KB | tduong |
| #14 | interdiff-2660446-11-14.txt | 1.8 KB | tduong |
| #14 | 2660446-fake_test_only.patch | 10.06 KB | tduong |
| #14 | interdiff-fake_test_only.txt | 467 bytes | tduong |
Comments
Comment #2
tduong commentedI cannot find which issue is this follow up from ? Can you give some more details about the test please ?
Comment #3
edurenye commentedComment #4
tduong commentedFinally able to upload the test coverage for this default argument.
Comment #5
dawehnerAwesome!
Yeah, let's remove that todo!
Let's quickly make that a
public functionIMHO we can get rid of that bit of the testcode. Do you think it really adds test value?
Comment #6
tduong commented1) done
2) set
publicalso for the other functions3) most of other tests that place a block use these code lines so I took from them, but no, not really needed here. Dropped it :)
Comment #7
dawehnerNice work!
Comment #8
catchShould this be:
"Create a node where the view should be shown in the block"?
This asserts for the view title, not the node title - is just the comment wrong?
Comment #9
tduong commentedAs I understand, the goal of this test is to check that using the contextual filter and selecting 'Content ID from URL' as default argument, then the node (title) is displayed on the node itself as a view block. Correct me if I'm wrong!
Fixed comment, fixed assertion for $node->getTitle().
Comment #10
dawehnerWhat is this actually checking? I mean the node title of the node itself probably appears alright on the page.
Comment #11
tduong commentedReplaced that assertion with an
assertFieldByXpath. Sorry, I should have thought that...Comment #12
dawehnerIs there no class or something like that we can leverage? This is super unspecified selector.
Comment #13
berdirCan you upload a fake "test-only" patch that breaks that plugin? In the argument default plugin, instead of returning a value, just do a return NULL; or so and then the test should fail. upload that as a patch.
Comment #14
tduong commentedDiscussed with @berdir and it was pretty challenging to make this test to fail...
Anyway, changed the way we check for the node title's existence IN the block displayed in the pages by looking for the position of the node title in the block XML as a string.
On the fake_test_only, since we always cache the 'url' argument
there is no other way to break the code to make a test fail but forcing a 'broken' return in \Drupal\node\Plugin\views\argument_default\Node::getArgument().
Hope this makes sense and is good enough. :D
Comment #16
dawehnerNice, I like that!
Comment #17
catchYeah I like that too.
Committed/pushed to 8.1.x and cherry-picked to 8.0.x. Thanks!