Problem/Motivation
I'm getting the following error when running ExistingSite tests using the weitzman/drupal-test-traits project. It's phpunit stuff but using a real database.
RuntimeException: Case mismatch between loaded and declared class names: "Drupal\viewsreference\ViewsreferenceServiceProvider" vs "Drupal\viewsreference\ViewsReferenceServiceProvider".
There does not appear to be any problems with the functionality on the site, so this may really be a bug with drupal-test-traits or maybe with something else. But I found the following reference as I was digging:
Note that if you want this service alteration to be recognized automatically, the name of this class is required to be a CamelCase version of your module's machine name followed by ServiceProvider
(see https://www.drupal.org/docs/drupal-apis/services-and-dependency-injectio...)
Steps to reproduce
TBD
Proposed resolution
Modify name of service file and class to follow naming conventions outlined in the provided link. Make that R lowercase:
ViewsReferenceServiceProvider.php => ViewsreferenceServiceProvider.php
ViewsReferenceServiceProvider => ViewsreferenceServiceProvider
Remaining tasks
Determine whether this is a bug in viewsreference or in a different project (drupal-test-traits or my custom code, etc.).
User interface changes
None.
API changes
TBD
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 3207819-service-provider-rename.patch | 494 bytes | johan_vm |
Issue fork viewsreference-3207819
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 #3
sam152 commentedI believe this is a bug in the viewsreference module. Here is a snippet of code from DrupalKernel:
You can see it expects a camelized version of the module name, which in this case, since there is no underscore in the module name would be "Viewsreference".
It just so happens the DebugClassLoader used by symfony and Drupal to check deprecations during testing has additional checks for when class capitalisation is incorrect:
Fix looks good to me.
Comment #5
seanbMerged! Thanks for the extra explanation @Sam152.
Comment #6
seanbComment #8
johan_vm commentedCurrently I have the same issue in the latest release branch (8.x-2.x-beta2). Since beta3 is not (yet) released we have to make due with a patch.
Comment #9
johan_vm commentedComment #10
johan_vm commentedComment #11
johan_vm commented