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
In #2876669: Fix dependency version requirement declarations in components we're using a travis-based test to determine the proper version constraints for Drupal components, including Plugin.
We can't test the Plugin component independently of the rest of Drupal core, because it has a requirement on the plugin_test module, which our testing rig is unable to locate because we're only using the component codebase.
Also, the principle of isolation for the components should require us to make sure the tests can be run in isolation.
Proposed resolution
- Create a fixture class within the \Drupal\Component\Plugin namespace.
- Use that in the test.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#12 | 2661542_12.patch | 10.86 KB | Mile23 |
Comments
Comment #2
Mile23Comment #8
Mile23This patch adds some vegetable plugins to the component test namespace, to compliment the fruit plugins used in the test module.
This is a testing improvement so it should not conflict with 8.5.0 release. If we can get this in to 8.5.x, then we can proceed more quickly with verifying the constraints for components. We'd hope to get updated constraints into 8.5.0 release as well.
Comment #9
Mile23Comment #10
MixologicSeems duplicative to a degree, but then again, looking at plugin_test it doesn't seem that we've got a lot of choice in the matter.
The reality is that its sad that the plugins do not ship with their own tests, and do not have a require-dev defined for them. But obv's thats a gargantuan undertaking to get that all unraveled and re-woven.
We should consider whether or not 'fixture' is the appropriate subdirectory
We currently have the following spread of choices:
So if we add 'fixture' we can complete the inconsistency quadrangle of Lower/Uppper case + Plural/NonPlural. But if we're aiming for consistency, we probably want it under
Since we already have two votes for that, and the other subdirs under Plugin are Uppercase. But maybe thats been decided elsewhere, and everything is already wrong. Who knows.
Comment #11
Mile23Oh man. I hadn't noticed about the case of the other components.
Well, for some reason SoP seems to be to have plugin namespaces defined in lower-case. And then in modules we have lower-case 'fixtures,' such as core/modules/system/tests/fixtures.
Also Fixture vs. Fixtures. Hmmmmm.
That's why it's vegetables instead of fruits. :-)
Yah, hence the travis builder which unravels and then reweaves: https://github.com/paul-m/drupal_component_tester
See also: #1826054-12: [Meta] Expose Drupal Components outside of Drupal and subsequent conversation. :-)
Comment #12
Mile23Added a follow-up where the naming of fixtures can be blessed: #2944520: Normalize on fixtures/ directory name for tests
Changed to Fixtures for (marginal) consistency with the other components.
Comment #13
borisson_I like the consistency, looks solid.
Comment #14
alexpottCommitted and pushed 0414f401b4 to 8.6.x and 3c79fbcfc2 to 8.5.x. Thanks!
Backported to 8.5.x since it is a test only change.