Add test coverage for views exposed filters and batch

Created on 20 December 2023, 6 months ago
Updated 21 December 2023, 6 months ago

Problem/Motivation

πŸ› Exposed filter values ignored when using batch Needs work shows that we're missing test coverage for batch operations in views with exposed filters, which is implemented by modules such as views_data_export. We should try to add test coverage for this to core, expanding \Drupal\Tests\views\Functional\UserBatchActionTest::testUserAction looks like the best option.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated less than a minute ago

Created by

πŸ‡¬πŸ‡§United Kingdom catch

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @catch
  • πŸ‡¬πŸ‡§United Kingdom catch
  • I did some investigation on how to approach this. The code in \Drupal\views\Form\ViewsExposedForm::buildForm doesn't really matter when running the user_batch_action_test_action on selected entities in a view, because that Action plugin adds an operation for each selected entity. The view does actually get executed per batch request, because the view executable object is nested within the comple_form property of the form state object. And as the batch is loaded from the database and unserialized, the view execute object within is unserialized and executed, but does not affect which entities are acted on.

    The issue that surfaced with the views_data_export module was that the batch operations re-executed the view (with updated offset) on every batch request, so if the exposed filters/data was not set, the query did not produce the correct entities to export. Creating a test to catch this involves replicating this behavior, maybe with a test views display plugin very similar to VDE's.

Production build 0.69.0 2024