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.
The BLT/Behat-related classes from the tests/src and tests/contexts subdirectories are being autoloaded by composer and are interfering with stand-alone Behat testing.
As I understand it, these test classes are now deprecated and were left in the codebase for backwards compatibility.
This patch removes the autoload so the classes will no longer be loaded by default.
Comments
Comment #2
cameron prince CreditAttribution: cameron prince as a volunteer and at CivicActions for Centers for Medicare and Medicaid Services commentedComment #3
cameron prince CreditAttribution: cameron prince as a volunteer and at CivicActions for Centers for Medicare and Medicaid Services commentedComment #4
phenaproximaThe last time the Behat stuff was touched was, apparently, over 2 years ago. And it's adorned with a strongly worded warning that it is old, deprecated, and not to be used.
Since this is causing autoloader issues in the wild, I think it's high time that we removed these classes from the autoloader. The files can stay, for the time being, in case there are naughty projects out there which are using them. But I think more than enough time has passed to require people who are still using this stuff to add it to their own autoloader (and hopefully, to their own project, natively).
Therefore, this patch looks good to me. I'll roll a new minor release after committing it.
Comment #5
phenaproximaComment #7
phenaproximaCommitted and pushed to 8.x-5.x. Thanks!
Comment #8
sylus CreditAttribution: sylus commentedI was getting the following so i just did this quick rename which seemed to resolve :)
Comment #9
skirtley CreditAttribution: skirtley commentedWanted to bump the patch from @sylus, I think this needs to be merged (or something similar), how the project current sits at 5.10 throws the error sylus pointed out if you run:
blt tests:behat
I also believe it is breaking Acquia pipeline jobs (the same behat related error).
Comment #10
sylus CreditAttribution: sylus commentedComment #11
cameron prince CreditAttribution: cameron prince as a volunteer and at CivicActions for Centers for Medicare and Medicaid Services commentedThe tests are deprecated and were only left in place to give those still using them time to pull them into their own project. We see the same error as #8, but worked around the tests remaining in the codebase using this in composer.json:
Comment #12
alfattal CreditAttribution: alfattal as a volunteer commentedI was having the same issue as @skirtley indicated where Acquia Pipeline jobs kept failing with the behat related error. The fix in #11 seems to complement the patch in #10.
Comment #13
bkosborneSame #8 error for me, but I'm puzzled as to why running the tests via BLT causes this problem. I've copied the behat contexts to my own folder, added them to my composer classmap. Why is BLT still even looking at ViewsContext.behat.inc file from lighting_core? It shouldn't even know about it. Strange.
Comment #15
sylus CreditAttribution: sylus commentedComment #16
smulvih2#11 worked for me.
Comment #17
Jon PughFWIW I am still getting the error. I had to fully remove the .behat.inc files to get bin/behat to run.
drupal/lightning_core * 5.14.0
behat/behat v3.13.0
drupal/drupal-extension v5.0.0rc1