Problem/Motivation

When building a site using a different front controller than drupal/drupal, Drupal core's (drupal/core) dependencies that are needed for the test tools (Mink is needed by BrowserTestBase, for instance) are never installed, because they are part of core's require-dev packages instead of require. This is a bug, as those dependencies are not just needed for developing core, but also for other Drupal extensions.

Proposed resolution

In the future we may want to split off our test tools to a separate project we can pull in, but for now we can fix the problem by moving these dependencies from require-dev to require in ./core/composer.json.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

Xano created an issue. See original summary.

klausi’s picture

I don't think so - if you need BrowserTestBase then it means you are writing tests, so you need to copy core's require-dev section to your require-dev section. Your project outside of Drupal will not need BrowserTestBase for its actual production functionality, right?

Xano’s picture

Modules using core's test tools should not have to go through the effort of keeping up with core's 'dev' dependencies, as that would just be plain bad DX. As explained in the issue summary, ideally these tools would all be part of the same separate testing tools package, but they aren't now, so our options are limited.

larowlan’s picture

I think until we have a separate testing process, keeping them in require-dev and needing to copy is the best option. Polluting the production autoloader/classmap with all the test-only classes would be counterproductive and bad for performance.

Xano’s picture

Sounds like we have another reason to finally get #2474007: Add a “General” project type to Drupal.org done.

klausi’s picture

Status: Active » Closed (won't fix)

What you can do is publish a xano/drupal-testing meta package on packagist that is just a copy of core's require-dev section. That way any other project can just require-dev that without maintaining the copy of core's require-dev section. But not sure that is really worth it ...

Anyway, for core I think this is won't fix because test dependencies should not be on a production site, so they don't belong in the require section.

Xano’s picture

Status: Closed (won't fix) » Active

If testing tools do not belong in production code, should we fix #2474007: Add a “General” project type to Drupal.org, and then use this issue to move the code to a library? That would solve the problem for core, and let contrib simply pull in all of core's tools at once.

Xano’s picture

I just ran into issues with a code base that required PHPUnit 5.3, but used core's base classes which throw a large number of method deprecation warnings when used with this PHPUnit version. Using the replacement methods in PHPUnit 5 is not possible, because these base classes come from core which uses (but does not technically require) PHPUnit 4. This is another example of how our test tool dependency management fails currently.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

longwave’s picture

Status: Active » Closed (duplicate)

This was solved by #3087626: Convert drupal/core-recommended & c. into a subtree split where we added the drupal/core-dev metapackage for development tools.