Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.Problem/Motivation
While writing some complicated tests and using this library as a framework, I discovered and fixed a few bugs.
- Set the
rootproperty insrc/Stub/ModuleHandlerStub.php. This allows for methods like::addModule()to function as expected. The module I wrote adds third party settings to a non-core widget so I needed to be able to instantiate the widget within my test. The widget plugin manager will remove any widgets defined by modules that aren't "enabled" in themodule_handlerservice. - The
::createFieldItemDefinitionStubmethod insrc/StubFactory/FieldItemListStubFactory.phpdoes not use the$isBaseFieldargument. - The
::initServiceFromYamlmethod insrc/TestHelpers.phpdoes not pass the correct arguments to the service constructor for services that define a parent. For example: most plugin managers. - When calling
TestHelpers::service()with$initService = TRUEthe$mockableMethodsare not passed when callingTestHelpers::initService()
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | test-helpers--bug-fixes--3388157.patch | 4.04 KB | j.cowher |
Issue fork test_helpers-3388157
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
j.cowher commentedComment #3
murzComment #5
murz@j.cowher Thank you for the patch, really good bug catching! I created a MR to have a more convenient review process, and put a little suggestion, please take a look.
Also, I will cover these bugs by unit tests, to not have regressions in the future.
Comment #6
murzI added unit tests to cover these bugs, and about "parent" for services - the current patch is a good first step, but to fully cover this seems we need to extend the base implementation of initiation for core services, so I created a separate issue for this: #3388492: Add support for initiating services with parent service
Comment #8
murzFixed and merged.