- "Forward-compatible" contributed modules (designed for D7 + D8) cannot use PSR-0 tests.
- Add optional support for PSR-0 tests to Simpletest in D7.
All in contrib? Nope, doesn't work.
The first idea would be to do it all in contrib:
- Use a contrib PSR-0 class loader, e.g. classloader module or xautoload module.
- Write a contrib module that can discover the PSR-0 test classes, and that will register them with hook_simpletest_alter().
This was tried here with xautoload:
This approach does work locally, if the admin makes sure that the respective contrib modules are enabled.
However, it does not work with testbot / PIFR for the automated tests on drupal.org. Why?
- testbot does not install any contrib modules prior to test discovery. (and apparently we cannot force it to do so, or noone really wants that)
- pifr has a custom discovery mechanism which ignores hook_simpletest_alter().
Besides, we don't want to depend too much on contrib.
Proposed solution (topic starter)
- Backport the changes from to make PSR-0 tests possible in contributed modules.
Proposed alternative solution (#26, #29, #34, ff)
Do everything in core, but with minimal custom solutions instead of backported Symfony/D8 components.
- Discovery of PSR-0 test classes in simpletest module.
- Minimal class loading (autoload) solution for PSR-0 test classes in simpletest module.
- Some minor fixes on components that cannot handle class names with backslash (namespace separator).
Notes (refering to the first proposal)
- http://drupal.org/project/classloader is a direct backport of D8's
Note: The Class Loader module might be "merged" into Autoload module (see), but that won't change its implementation.
- d.o testbots will find and support PSR-0 tests as soon as has been deployed.
|#121||1693398-Followup.patch||8.98 KB||Sylvain Lecoy|
|PASSED: [[SimpleTest]]: [MySQL] 40,373 pass(es).|
|#119||1693398-Follow-up.patch||8.8 KB||Sylvain Lecoy|
|PASSED: [[SimpleTest]]: [MySQL] 40,366 pass(es).|
|FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-7.x-psr-0-test-classes-1693398-113-vs-0_0.patch. Unable to apply patch. See the log in the details link for more information.|
|PASSED: [[SimpleTest]]: [MySQL] 39,945 pass(es).|
|PASSED: [[SimpleTest]]: [MySQL] 40,239 pass(es).|