Problem/Motivation

In #3560629: You have requested a non-existent service "views.views_field_default_data" it was discovered that the Drupal 11.2 compatibility tests introduced a bug that was not found by Gitlab CI's automated tests. SVG Image Field module does not properly test its Views integration.

Steps to reproduce

Install Drupal 11.2+ with SVG Image Field 2.3.x
Apply https://git.drupalcode.org/project/svg_image_field/-/merge_requests/45.diff in reverse.
Test SVG Image Field views integration and try to reproduce the issue.

Proposed resolution

Add test coverage for the Views integration.

Remaining tasks

User interface changes

API changes

Data model changes

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

jwilson3 created an issue. See original summary.

jwilson3’s picture

Issue summary: View changes

jwilson3’s picture

Status: Active » Reviewed & tested by the community

I've confirmed that tests pass on 11.1 and fail on 11.2 when I revert the fix from #3560629: You have requested a non-existent service "views.views_field_default_data".

$ ddev drush st | grep version
Drupal version : 11.2.8
PHP version    : 8.3.27
Drush version  : 13.7.0.0

With the fix:

$ ddev phpunit tests/src/Kernel/ViewsIntegrationTest.php
PHPUnit 11.5.45 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.27

..........                                                        10 / 10 (100%)

Time: 00:15.667, Memory: 6.00 MB

OK, but there were issues!
Tests: 10, Assertions: 123, PHPUnit Deprecations: 121.

Without the fix:

$ git revert ef099d9
[3560658-views-test-coverage 4f56e74] Revert "Issue #3560629 by jstoller: Fix non-existent service error."
 1 file changed, 1 insertion(+), 1 deletion(-)

$ ddev phpunit tests/src/Kernel/ViewsIntegrationTest.php
PHPUnit 11.5.45 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.27

EEEEEEEEEE                                                        10 / 10 (100%)

Time: 00:18.479, Memory: 6.00 MB

There were 10 errors:

1) Drupal\Tests\svg_image_field\Kernel\ViewsIntegrationTest::testViewsDataGeneration
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "views.views_field_default_data".

/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:1054
/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:620
/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:583
/var/www/html/web/core/lib/Drupal.php:207
/var/www/html/svg_image_field.views.inc:28
/var/www/html/web/core/lib/Drupal/Component/Utility/DeprecationHelper.php:45
/var/www/html/svg_image_field.views.inc:25
/var/www/html/tests/src/Kernel/ViewsIntegrationTest.php:136

2) Drupal\Tests\svg_image_field\Kernel\ViewsIntegrationTest::testViewsDataFieldColumns
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "views.views_field_default_data".

/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:1054
/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:620
/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:583
/var/www/html/web/core/lib/Drupal.php:207
/var/www/html/svg_image_field.views.inc:28
/var/www/html/web/core/lib/Drupal/Component/Utility/DeprecationHelper.php:45
/var/www/html/svg_image_field.views.inc:25
/var/www/html/tests/src/Kernel/ViewsIntegrationTest.php:168

3) Drupal\Tests\svg_image_field\Kernel\ViewsIntegrationTest::testReverseRelationshipViewsData
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "views.views_field_default_data".

/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:1054
/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:620
/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:583
/var/www/html/web/core/lib/Drupal.php:207
/var/www/html/svg_image_field.views.inc:28
/var/www/html/web/core/lib/Drupal/Component/Utility/DeprecationHelper.php:45
/var/www/html/svg_image_field.views.inc:25
/var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:369
/var/www/html/web/core/modules/views/src/Hook/ViewsViewsHooks.php:179
/var/www/html/web/core/modules/views/src/ViewsData.php:219
/var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:357
/var/www/html/web/core/modules/views/src/ViewsData.php:218
/var/www/html/web/core/modules/views/src/ViewsData.php:107
/var/www/html/tests/src/Kernel/ViewsIntegrationTest.php:205

4) Drupal\Tests\svg_image_field\Kernel\ViewsIntegrationTest::testMultipleFieldsMultipleBundles
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "views.views_field_default_data".

/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:1054
/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:620
/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:583
/var/www/html/web/core/lib/Drupal.php:207
/var/www/html/svg_image_field.views.inc:28
/var/www/html/web/core/lib/Drupal/Component/Utility/DeprecationHelper.php:45
/var/www/html/svg_image_field.views.inc:25
/var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:369
/var/www/html/web/core/modules/views/src/Hook/ViewsViewsHooks.php:179
/var/www/html/web/core/modules/views/src/ViewsData.php:219
/var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:357
/var/www/html/web/core/modules/views/src/ViewsData.php:218
/var/www/html/web/core/modules/views/src/ViewsData.php:107
/var/www/html/tests/src/Kernel/ViewsIntegrationTest.php:243

5) Drupal\Tests\svg_image_field\Kernel\ViewsIntegrationTest::testViewsQueryWithSvgField
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "views.views_field_default_data".

/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:1054
/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:620
/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:583
/var/www/html/web/core/lib/Drupal.php:207
/var/www/html/svg_image_field.views.inc:28
/var/www/html/web/core/lib/Drupal/Component/Utility/DeprecationHelper.php:45
/var/www/html/svg_image_field.views.inc:25
/var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:369
/var/www/html/web/core/modules/views/src/Hook/ViewsViewsHooks.php:179
/var/www/html/web/core/modules/views/src/ViewsData.php:219
/var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:357
/var/www/html/web/core/modules/views/src/ViewsData.php:218
/var/www/html/web/core/modules/views/src/ViewsData.php:142
/var/www/html/web/core/modules/views/src/Plugin/ViewsHandlerManager.php:96
/var/www/html/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php:899
/var/www/html/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php:934
/var/www/html/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php:971
/var/www/html/web/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php:71
/var/www/html/web/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php:89
/var/www/html/web/core/modules/views/src/Entity/View.php:283
/var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php:329
/var/www/html/web/core/modules/views/src/Entity/View.php:293
/var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:529
/var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:484
/var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:239
/var/www/html/web/core/lib/Drupal/Core/Entity/EntityBase.php:370
/var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php:618
/var/www/html/tests/src/Kernel/ViewsIntegrationTest.php:347

6) Drupal\Tests\svg_image_field\Kernel\ViewsIntegrationTest::testViewsFilterBySvgAltText
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "views.views_field_default_data".

/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:1054
/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:620
/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:583
/var/www/html/web/core/lib/Drupal.php:207
/var/www/html/svg_image_field.views.inc:28
/var/www/html/web/core/lib/Drupal/Component/Utility/DeprecationHelper.php:45
/var/www/html/svg_image_field.views.inc:25
/var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:369
/var/www/html/web/core/modules/views/src/Hook/ViewsViewsHooks.php:179
/var/www/html/web/core/modules/views/src/ViewsData.php:219
/var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:357
/var/www/html/web/core/modules/views/src/ViewsData.php:218
/var/www/html/web/core/modules/views/src/ViewsData.php:142
/var/www/html/web/core/modules/views/src/Plugin/ViewsHandlerManager.php:96
/var/www/html/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php:899
/var/www/html/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php:934
/var/www/html/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php:971
/var/www/html/web/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php:71
/var/www/html/web/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php:89
/var/www/html/web/core/modules/views/src/Entity/View.php:283
/var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php:329
/var/www/html/web/core/modules/views/src/Entity/View.php:293
/var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:529
/var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:484
/var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:239
/var/www/html/web/core/lib/Drupal/Core/Entity/EntityBase.php:370
/var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php:618
/var/www/html/tests/src/Kernel/ViewsIntegrationTest.php:425

7) Drupal\Tests\svg_image_field\Kernel\ViewsIntegrationTest::testViewsFileRelationship
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "views.views_field_default_data".

/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:1054
/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:620
/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:583
/var/www/html/web/core/lib/Drupal.php:207
/var/www/html/svg_image_field.views.inc:28
/var/www/html/web/core/lib/Drupal/Component/Utility/DeprecationHelper.php:45
/var/www/html/svg_image_field.views.inc:25
/var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:369
/var/www/html/web/core/modules/views/src/Hook/ViewsViewsHooks.php:179
/var/www/html/web/core/modules/views/src/ViewsData.php:219
/var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:357
/var/www/html/web/core/modules/views/src/ViewsData.php:218
/var/www/html/web/core/modules/views/src/ViewsData.php:142
/var/www/html/web/core/modules/views/src/Plugin/ViewsHandlerManager.php:96
/var/www/html/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php:899
/var/www/html/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php:934
/var/www/html/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php:971
/var/www/html/web/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php:71
/var/www/html/web/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php:89
/var/www/html/web/core/modules/views/src/Entity/View.php:283
/var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php:329
/var/www/html/web/core/modules/views/src/Entity/View.php:293
/var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:529
/var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:484
/var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:239
/var/www/html/web/core/lib/Drupal/Core/Entity/EntityBase.php:370
/var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php:618
/var/www/html/tests/src/Kernel/ViewsIntegrationTest.php:493

8) Drupal\Tests\svg_image_field\Kernel\ViewsIntegrationTest::testRelationshipLabel
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "views.views_field_default_data".

/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:1054
/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:620
/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:583
/var/www/html/web/core/lib/Drupal.php:207
/var/www/html/svg_image_field.views.inc:28
/var/www/html/web/core/lib/Drupal/Component/Utility/DeprecationHelper.php:45
/var/www/html/svg_image_field.views.inc:25
/var/www/html/tests/src/Kernel/ViewsIntegrationTest.php:512

9) Drupal\Tests\svg_image_field\Kernel\ViewsIntegrationTest::testMultiValueFieldViewsData
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "views.views_field_default_data".

/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:1054
/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:620
/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:583
/var/www/html/web/core/lib/Drupal.php:207
/var/www/html/svg_image_field.views.inc:28
/var/www/html/web/core/lib/Drupal/Component/Utility/DeprecationHelper.php:45
/var/www/html/svg_image_field.views.inc:25
/var/www/html/tests/src/Kernel/ViewsIntegrationTest.php:552

10) Drupal\Tests\svg_image_field\Kernel\ViewsIntegrationTest::testReverseRelationshipDetails
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "views.views_field_default_data".

/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:1054
/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:620
/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:583
/var/www/html/web/core/lib/Drupal.php:207
/var/www/html/svg_image_field.views.inc:28
/var/www/html/web/core/lib/Drupal/Component/Utility/DeprecationHelper.php:45
/var/www/html/svg_image_field.views.inc:25
/var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:369
/var/www/html/web/core/modules/views/src/Hook/ViewsViewsHooks.php:179
/var/www/html/web/core/modules/views/src/ViewsData.php:219
/var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:357
/var/www/html/web/core/modules/views/src/ViewsData.php:218
/var/www/html/web/core/modules/views/src/ViewsData.php:107
/var/www/html/tests/src/Kernel/ViewsIntegrationTest.php:577

ERRORS!
Tests: 10, Assertions: 80, Errors: 10, PHPUnit Deprecations: 121.
Failed to run phpunit tests/src/Kernel/ViewsIntegrationTest.php: exit status 2

Unrelated:

PHPUnit Deprecations: 121.

PHPUnit 11 deprecated docblock annotations in favor of PHP 8 attributes. The 121 deprecations are from:

  • @group on the class
  • @covers on each test method (10+ occurrences)
  • Possibly multiplied by internal PHPUnit processing

Despite the fact that we're requiring PHP 8, the module still targets multiple Drupal versions (including 10.x, 11.1, 11.2+). Drupal 10.x still officially supports PHPUnit 9/10, so I suggest we ignore these internal deprecation warnings for now. They're informational and won't break anything until PHPUnit 12 removes support for annotations entirely.

jwilson3’s picture

Assigned: Unassigned » jwilson3

  • jwilson3 committed 545bead8 on 2.3.x
    Issue #3560658 by jwilson3: Add test coverage for views integration
    
jwilson3’s picture

Status: Reviewed & tested by the community » Fixed

This issue has been fixed and released in 2.3.7.

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.

jwilson3’s picture

Assigned: jwilson3 » Unassigned

Status: Fixed » Closed (fixed)

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