Problem/Motivation

While writing some complicated tests and using this library as a framework, I discovered and fixed a few bugs.

  • Set the root property in src/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 the module_handler service.
  • The ::createFieldItemDefinitionStub method in src/StubFactory/FieldItemListStubFactory.php does not use the $isBaseField argument.
  • The ::initServiceFromYaml method in src/TestHelpers.php does 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 = TRUE the $mockableMethods are not passed when calling TestHelpers::initService()
CommentFileSizeAuthor
#2 test-helpers--bug-fixes--3388157.patch4.04 KBj.cowher
Command icon 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

j.cowher created an issue. See original summary.

j.cowher’s picture

StatusFileSize
new4.04 KB
murz’s picture

Version: 1.2.0 » 1.3.x-dev

murz’s picture

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

murz’s picture

I 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

  • Murz committed a1977a64 on 1.3.x
    Issue #3388157 by Murz, j.cowher: Handful of bug fixes
    
murz’s picture

Status: Needs review » Fixed

Fixed and merged.

Status: Fixed » Closed (fixed)

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