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.
Comment | File | Size | Author |
---|---|---|---|
#5 | simple_sitemap-fix_tests-3000655-0.patch | 39.42 KB | wells |
Comments
Comment #2
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedComment #3
wellsI have started to look at updating these tests. One thing I ran into immediately is caching issues. E.g.
SimplesitemapTest::testSetBundleSettings()
fails on the second set of assertions because the the sitemap file is still cached after changing the bundle settings.Should
Simplesitemap::generateSitemap()
be invalidating the appropriate cache after it completes? I suspect so, but I'm still a little hazy on the caching changes in Drupal 8. Right now the only place I see specific cache invalidation happening isSimplesitemap::removeSitemap()
.Comment #4
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedHey wells, you looking into the tests makes me happy.
Fixing them up is the first step; the next step will be creating more of them for the new functionalities in 3.x.
A variant's cache should be invalidated upon its deletion. Now that generation has been streamlined, I have just pushed some code making variants invalidate as soon as they are deleted from the database. The invalidation is called directly in removeSitemapVariant() but only if a published variant is being removed.
I have not tested it, but I hope this fixes the test issues you are having. If not, feel free to comment out the particular test that is not passing and then we can fix the variant caching in this issue: #2972131: Cache sitemap on a per variant basis.
Thanks again for your help with the tests!
Comment #5
wellsAttached is an initial patch that gets things going again. In local testing I am getting the following results:
Errors:
1) It looks like
Simplesitemap::removeCustomLinks
is working, butSimplesitemap::generateSitemap
doesn't do anything if there is nothing to generate (I suspect this should remove the sitemap?).2) Changing the bundle
index
setting fromTRUE
toFALSE
does not appear to cause the sitemap to rebuild. Maybe this is also a "nothing to generate" issue?Failures:
1) The
remove_duplicates
setting does not appear to be implemented yet.Once these issues are resolved, I believe the existing tests will pass.
Comment #7
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedThanks. I believe the problem is not the queue rebuilding at it is rebuild when queue is empty. It appears to work outside of the tests without issue, I commented it out for now. Tests are a work in progress anyway.