- Issue created by @catch
I did some investigation on how to approach this. The code in
\Drupal\views\Form\ViewsExposedForm::buildForm
doesn't really matter when running theuser_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 thecomple_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.