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.
Hopefully we can leverage existing tests in the core taxonomy module.
Comment | File | Size | Author |
---|---|---|---|
#10 | 3104318-10.patch | 28.56 KB | larowlan |
#10 | interdiff-3104318-10.txt | 4.25 KB | larowlan |
#6 | 3104318-6.patch | 27.43 KB | larowlan |
#6 | 3104318-interdiff-6.txt | 8.91 KB | larowlan |
#4 | 3104318-4.patch | 18.51 KB | larowlan |
Comments
Comment #2
cameron prince CreditAttribution: cameron prince at CivicActions commentedIn reviewing core taxonomy module's tests, I believe we need these three for starters:
You can see them here: https://git.drupalcode.org/project/drupal/blob/8.8.x/core/modules/taxono...
I'm going to get started by extending TaxonomyIndexTidUiTest.php and seeing what all needs modifying.
Comment #3
cameron prince CreditAttribution: cameron prince at CivicActions commentedThis patch stubs out testing, but still needs work.
The test view needs to be updated to use the TEI filter plugin instead of core's and something is causing:
I'm out of time for now and the 1.1 release needs to go out. Hopefully, we'll get tests in 1.2.
Comment #4
larowlanThis passes locally
Comment #5
larowlancan you enable testing on https://www.drupal.org/node/1185660/qa so testbot can test patches?
Comment #6
larowlanHere's a kernel test that covers the basic entity CRUD operations and a base test that I'll make use of in #3108170: Add a formatter that does 'backfilling' of entity references (more like this, similar by term)
Comment #7
larowlanthis is the kernel test in a nutshell 🥜
Comment #8
Lendudecomment and test don't align, the test should have depth 1 I think
should probably describe what it asserts too
Why isn't $entity_type_id used? And shouldn't you be able to pass 'termz' and not have to hard code it here?
missing docblock although the method name is pretty descriptive :)
Might be nice to test that it only deletes the records of the passed entity and not all records? Since the assertion now assumes that this is the same thing.
The module description states : "The core {taxonomy_index} table only maintains its data for published nodes. This module maintains its data for all entity types (regardless of published or not) and also indexed by revision."
I'm not seeing any coverage for the unpublished and revisions part.
Comment #9
larowlanComment #10
larowlanfixed 1,2,4,5
re 3 - its so sub-classes can easily enable other entity-types - see https://git.drupalcode.org/project/backfill_formatter/blob/8.x-1.x/tests... and https://git.drupalcode.org/project/backfill_formatter/blob/8.x-1.x/tests...
Comment #11
larowlanAdding related issues this blocks
Comment #12
gambryDouble
..
.This is unused and can be removed?
Just a consideration... we are testing the module against views listing nodes... and not custom entities which the module is mostly - only, really - used for. Is there a reason?
I don't think this is a big issue, but this Trait has been
introducedmoved in this namespace in 8.8.x and so instances using 8.7 can't use this, withoutclass_alias()
. An issue? I don't think so, but worth mentioning.All good then. I'm RTBCing this as 1) and 2) can be fixed on commit and the other two are more considerations rather than requests.
Thanks. When this is in we can unblock #3109722: Entity IDs can be strings in Drupal 8.
And finally RE last comment from #8:
I don't think this has been actioned, but probably can be done in a follow up?
Comment #14
gambryI need to re-open this as the schema for the views plugins are missing. Something like (please double-check!):
Without this if using the module's filter plugin and select any term for Limit list to selected items, Views UI throws a
InvalidArgumentException: The configuration property display.default.display_options.filters.taxonomy_entity_index_tid_depth.value.123 doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get()
because thevalue
data types defaults toviews.filter_value.*
which is expecting a string. And I presume similar errors may be thrown in some scenarios for the others plugins too.Comment #15
gambryForget about #14, I checked out the wrong commit. All looks good, although suggestions on #12 to be done on commit still apply.
Comment #16
larowlanCommitted this to 8.x-1.x
Fixed this on commit
I'll open a follow-up for the last item on #8 - thanks all.
Comment #17
larowlan#3164108: Add additional tests for unpublished/published entities For the follow up