function BatchInjectionCallbacks::themeCallback

Implements callback_batch_operation().

Tests the progress page theme.

File

core/modules/system/tests/modules/batch_test/src/BatchInjectionCallbacks.php, line 31

Class

BatchInjectionCallbacks
Batch callbacks using dependency injection for testing batches.

Namespace

Drupal\batch_test

Code

public function themeCallback() : void {
  $batch_test_helper = new BatchTestHelper();
  // Because drupalGet() steps through the full progressive batch before
  // returning control to the test function, we cannot test that the correct
  // theme is being used on the batch processing page by viewing that page
  // directly. Instead, we save the theme being used in a variable here, so
  // that it can be loaded and inspected in the thread running the test.
  $theme = $this->themeManager
    ->getActiveTheme()
    ->getName();
  $batch_test_helper->stack($theme);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.