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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Mile23 created an issue. See original summary.

Mile23’s picture

Issue summary: View changes

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.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.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.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.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should 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.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should 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.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should 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.

Mile23’s picture

Issue summary: View changes
Status: Active » Needs review
Related issues: +#2876669: Fix dependency version requirement declarations in components
FileSize
10.83 KB

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

Mile23’s picture

Issue summary: View changes
Mixologic’s picture

Seems 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:

core/tests/Drupal/Tests/Component/Annotation/Fixtures
core/tests/Drupal/Tests/Component/DependencyInjection/Fixture
core/tests/Drupal/Tests/Component/FileCache/Fixtures
core/tests/Drupal/Tests/Component/Utility/fixtures

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

core/tests/Drupal/Tests/Component/Plugin/Fixtures

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.

Mile23’s picture

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

Seems duplicative to a degree

That's why it's vegetables instead of fruits. :-)

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.

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. :-)

Mile23’s picture

Title: Drupal\Tests\Component\Plugin\DefaultFactoryTest requires a test module » Isolate Drupal\Tests\Component\Plugin\DefaultFactoryTest from core test module
Related issues: +#2944520: Normalize on fixtures/ directory name for tests
FileSize
10.86 KB
6.06 KB

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

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

I like the consistency, looks solid.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

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

  • alexpott committed 0414f40 on 8.6.x
    Issue #2661542 by Mile23, Mixologic: Isolate Drupal\Tests\Component\...

  • alexpott committed 3c79fbc on 8.5.x
    Issue #2661542 by Mile23, Mixologic: Isolate Drupal\Tests\Component\...

Status: Fixed » Closed (fixed)

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