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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

larowlan created an issue. See original summary.

jedihe’s picture

Let's try this patch. I added the test at core/tests/Drupal/Tests/Core/Theme/CoreThemesAutoloadedForTests.php

jedihe’s picture

Status: Active » Needs review

jedihe’s picture

No-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.

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

Hurray, thanks for the patch and the test. That is what we were looking for! Now we can unit test our theme classes!

joelpittet’s picture

For 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 ...

joelpittet credited jplana.

joelpittet’s picture

larowlan’s picture

Queued a test-run for the RTBC patch, for some reason it has not yet had one

Code looks good to me

  • larowlan committed ccc9255 on 9.2.x
    Issue #3209048 by jedihe, jplana: Core themes are not added to the test...
larowlan’s picture

Version: 9.2.x-dev » 9.1.x-dev
Status: Reviewed & tested by the community » Fixed

Committed ccc9255 and pushed to 9.2.x. Thanks!

As the risk of disruption here is low, backported to 9.1.x

Thanks folks

  • larowlan committed 5b68718 on 9.1.x
    Issue #3209048 by jedihe, jplana: Core themes are not added to the test...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.