Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This module does quite a lot, it turns out. It'd be great if there were tests to figure out if everything is working properly.
I'll try and document test cases as I find them here. Reviewing this module as part of #2325607: [meta] Get DMU working on Diff module.
Diff compare widgets
- testRevisionsList — go to node/%node/revisions/list and verify diff output is on page.
Diff comparison
- testRevisionsCompare — go to node/%node/revisions/view and verify diff comparison between 2 disparate revisions shows up.
- testRevisionsLatest — go to node/%node/revisions/view/latest and verify that diff comparison against latest revision is shown
Diff admin settings
- testDiffSettings — go to admin/config/content/diff and verify that main settings form is working properly.
- testDiffSettingsNodeEntity — go to admin/config/content/diff/entities/node and verify settings form is working properly.
- testDiffSettingsUserEntity — (not pictured) go to admin/config/content/diff/entities/user and verify settings form is working properly.
- testDiffSettingsFieldOverview — go to admin/config/content/diff/fields and verify form is working properly.
- testDiffSettingsFieldText — go to https://www.drupal.org/admin/config/content/diff/fields/text and verify form is working properly.
Inline differences block
- testDiffBlock — Make sure block shows up in block listing at admin/structure/block, verify it shows up on content types selected.
- testInlineDiff — (??? — not sure if this can be tested w/ SimpleTest). Test that changes are correctly highlighted when selecting revisions from block.
Diff buttons
- testViewChanges — verify that "View changes" button shows up on node edit form, shows diff at top when clicked.
Node type form settings
- testDiffSettingsNodeType — verify that Compare revisions options are working on e.g. Page.
Diff entity display
- testDiffDisplayMode — Go to admin/structure/types/manage/page/display, expand "Custom display settings, verify "revision comparison" shows up as a selectable view mode.
If someone feels exceptionally spunky
- testLimitedItems — verify that REVISION_LIST_SIZE is working properly.
- testExposedSorting — verify that diff sorting is working properly: DIFF_SORT_NONE, DIFF_SORT_VALUE, DIFF_SORT_CUSTOM.
- testHelpText — test that help text is exposed where it should be (admin/help/diff, node/%/revisions/%/view, node/%/revisions/view/%/%
- testDiffStates — test diff states (raw (Standard) / raw_plain (Marked down)
- testRevisionAdminTheme — tests that revisions pages are shown in admin theme
- testContentTypeRename — tests that when you rename a content type, all settings are remembered.
- testContentTypeDelete — tests that when you delete a content type, all settings are deleted.
- testDiffUsers — tests that diff features also work on users.
Comment | File | Size | Author |
---|---|---|---|
#9 | diff.test.diff | 4.41 KB | webchick |
#4 | Screen Shot 2014-08-26 at 4.14.02 PM.png | 53.44 KB | webchick |
#3 | Screen Shot 2014-08-26 at 4.10.29 PM.png | 32.71 KB | webchick |
#3 | Screen Shot 2014-08-26 at 4.09.43 PM.png | 16.87 KB | webchick |
#3 | Screen Shot 2014-08-26 at 4.04.23 PM.png | 38.16 KB | webchick |
Comments
Comment #1
webchickHere's what I have so far from reading through the code and taking screenshots as I discover things.
Comment #2
webchickFormatting.
Comment #3
webchickMoar stuffs.
Comment #4
webchickComment #5
webchickComment #6
Alan D. CreditAttribution: Alan D. commentedI actually wonder if "Inline differences block" is worth removing and creating a separate project for? Open to peoples opinions on this. It is one thing that I have never used, and it is one thing that is a bit problematic in terms of integration with other modules.
I am just stating this here so either to drop (maybe unrequired) or raise the priority (it is the bit that normally fails) depending on the answer :)
@webchick
Thanks for your mentoring here. I was letting the core structural changes to get done before starting to review things hard.
Comment #7
webchickOh, I think that's a totally fair feature to drop, from a module POV. *I* personally like it being there because then we get Drupal Module Upgrader working for configurable blocks and JS/CSS. ;)
Comment #8
Alan D. CreditAttribution: Alan D. commentedlol, lets keep it for the meantime then, but with the possible intent to either separate out into a sub-module or even another project latter.
Comment #9
webchickHere is the absolute most basic start. All it does is define a base class that does some of the boilerplate work (like creating a node with 3 revisions for each test), then defines a test method that:
1) Hits node/X/revisions and makes the Compare button exists
2) Submits the form with the Compare button to make sure there are no errors
3) Validates that the output on the diff comparison is what's expected
4) While we're in there any way, tests the next/previous difference links as well
This should hopefully give kind of an idea of what's needed here. I'm not sure how much further (if at all) I'll be able to take this, so uploading what I've got after an hour or two of copy/pasting a lot from modules/node/node.test. :)
Comment #10
miro_dietikerI just committed basic test coverage for 8.x in the current master port sandbox.
No configuration variation yet, but the default processes offered with default settings.
See #2422735: Provide basic test coverage