Problem/Motivation

The module declares ^12, but its tests have never run on Drupal 12: the next major jobs of the GitLab pipeline are manual. A local run on Drupal 12.0.0-beta1 (PHP 8.5, PHPUnit 12) found no Drupal 12 failure in the module code, but five kernel test classes fail and PHPUnit 12 warns about one data provider. All three causes are in the tests.

  • Missing filter module. In Drupal 12, TextItemBase::applyDefaultValue() asks FilterFormatRepositoryInterface for the fallback format whenever a text field item is created; in Drupal 11 only generateSampleValue() does. text depends on filter, but kernel tests do not enable dependencies. ImageImporterTest, CameraTypeVocabTest, OrganizationLabelTest and OrganizationAccessTest enable text without filter and fail with ServiceNotFoundException: You have requested a non-existent service "Drupal\filter\FilterFormatRepositoryInterface".
  • Field storage created before the entity schema. In EntityCrudTest, testSequenceFieldsInstalled(), testImportDetectionsFeaturesFieldConfig() and testImageFieldsInstalled() install the config of mapillary_entity, which creates field storages on mapillary_image, while setUp() installs only the sequence schemas. This is deprecated in drupal:11.2.0 and throws a LogicException in Drupal 12: Creating the "mapillary_image.width" field storage definition without the entity schema "mapillary_image" being installed is not allowed.
  • Extra data provider arguments. EntityApiPermissionsTest::entityTypeProvider() returns three values per data set; testHandlers() accepts two and testRoutes() one. PHPUnit 12 reports Data set "image" provided by ... has more arguments (3) than the test method accepts (2).

Steps to reproduce

  1. Set up Drupal 12.0.0-beta1 on PHP 8.5 with this module, the Drupal 12 merge requests of Geofield (#3598572: Automated Drupal 12 compatibility fixes for geofield 10.3.x-dev), Entity API (#3553240: Convert hooks to OOP) and Leaflet (#3599631: Automated Drupal 12 compatibility fixes for leaflet 10.4.x-dev), and || ^12 added to the Entity API and Leaflet info files.
  2. Run the kernel tests of the module, for example EntityCrudTest and ImageImporterTest in modules/mapillary_entity.
  3. The tests above fail with the errors quoted in Problem/Motivation.

Proposed resolution

  • Add filter to $modules of the four test classes.
  • In EntityCrudTest, install the entity schemas the mapillary_entity config needs before the config is installed.
  • Give testHandlers() and testRoutes() data sets with only the arguments they use, built from the same list of entity types as entityTypeProvider().
  • Run the module test suite on Drupal 11 and Drupal 12.

Remaining tasks

User interface changes

  • None.

API changes

  • None.

Data model changes

  • None.

Issue fork mapillary-3631047

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

orkutmuratyilmaz created an issue. See original summary.

  • 703b4557 committed on 1.0.x
    task: #3631047: Kernel tests fail on Drupal 12
    
    - Enable filter in the...
orkutmuratyilmaz’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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