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.
Problem/Motivation
drupal_phpunit_contrib_extension_directory_roots
does not add core/themes
but it should because claro uses classes for safe callbacks.
Steps to reproduce
Try to autoload a class from core/themes in a test
Proposed resolution
Add `core/themes` to the list in drupal_phpunit_contrib_extension_directory_roots
Add a unit test that asserts that ClaroPreRender can be autoloaded ($this->assertTrue(class_exists(...))
Remaining tasks
all of the above
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#5 | 3209048-core-themes-autoload-for-tests-4.patch | 1.23 KB | jedihe |
Comments
Comment #2
jedihe CreditAttribution: jedihe as a volunteer commentedLet's try this patch. I added the test at core/tests/Drupal/Tests/Core/Theme/CoreThemesAutoloadedForTests.php
Comment #3
jedihe CreditAttribution: jedihe as a volunteer commentedComment #5
jedihe CreditAttribution: jedihe as a volunteer commentedNo-op update for the patch: add the new item to the array following alphabetic ordering as the existing code does.
No need to trigger tests, as this is an obvious no-op from #2.
Comment #6
joelpittetHurray, thanks for the patch and the test. That is what we were looking for! Now we can unit test our theme classes!
Comment #7
joelpittetFor context, we did a variation of our test from the other issue with a unit test and ran into this bug, adding that link saved us from manually adding the class through
include_once $root ...
Comment #9
joelpittetComment #10
larowlanQueued a test-run for the RTBC patch, for some reason it has not yet had one
Code looks good to me
Comment #12
larowlanCommitted ccc9255 and pushed to 9.2.x. Thanks!
As the risk of disruption here is low, backported to 9.1.x
Thanks folks