Task to add additional test coverage for the various classes in \Drupal\Component\Plugin. Also, the current tests are in the core directory, which may mean they are intertwined with core overrides. These should be split into separate tests if that is the case.
See #1938068: Convert UnitTestBase to PHPUnit.
Current issues:
- #2368585: Expand unit testing for Drupal\Component\Plugin\ContextAwarePluginBase
- #2370183: Expand unit testing for Drupal\Component\Plugin\Discovery\DiscoveryTrait
- #2371531: Expand unit testing for Drupal\Component\Plugin\PluginManagerBase
- #2375737: Expand unit testing for Drupal\Component\Plugin\Factory\ReflectionFactory
- #2379419: Expand unit testing for Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator
- #2380029: Drupal\Component\Plugin\Derivative\DeriverBase is designed to error out.
Drupal\Component\Plugin\Context\Context gets its own section, due to needing a little refactoring and bug-fixing.
Comments
Comment #1
berdirBefore we do this, we should convert the existing tests to PHPUnit I think. That will increase the test coverage already, by a lot. There is also a bunch of classes that aren't touched at all yet, so the actual coverage of that component is much lower ;)
The test conversion however, is going to be blocked by a bunch of things.. Non-injected decorators like Cache (which is being replaced with the default plugin manager) and a very fun one: @Translation, which calls t(). Maybe that can call the service now and we can do some tricks with injection a container into Drupal...
Comment #2
jhedstromComment #3
yesct commented#1938068: Convert UnitTestBase to PHPUnit is fixed now.
we can come back to this to see what needs to be done.
Comment #4
mile23I thought I'd start on this.
I ended up testing Drupal\Core\Plugin by accident. :-)
Here's the issue: #2368019: Expand unit testing for Drupal\Core\Plugin\Context\ContextDefinition
Comment #5
mile23Here's one in the proper namespace: #2368585: Expand unit testing for Drupal\Component\Plugin\ContextAwarePluginBase
Comment #6
mile23Again with the tests! #2370183: Expand unit testing for Drupal\Component\Plugin\Discovery\DiscoveryTrait
Comment #7
mile23And... #2371531: Expand unit testing for Drupal\Component\Plugin\PluginManagerBase
Comment #8
mile23Comment #9
mile23The hits just keep on coming. #2375737: Expand unit testing for Drupal\Component\Plugin\Factory\ReflectionFactory
Comment #10
mile23Comment #11
mile23Comment #12
mile23Found a bug. #2380029: Drupal\Component\Plugin\Derivative\DeriverBase is designed to error out.
Comment #13
duaelfrI ran all the tests except the last one and made comments mainly about coding standards because the code seemed good to me.
Good job @Mile23!
Comment #14
mile23Comment #15
dawehner.
Comment #29
smustgrave commentedIs this one still relevant?