function _batch_test_title_callback

Same name in other branches
  1. 9 core/modules/system/tests/modules/batch_test/batch_test.module \_batch_test_title_callback()
  2. 8.9.x core/modules/system/tests/modules/batch_test/batch_test.module \_batch_test_title_callback()
  3. 11.x core/modules/system/tests/modules/batch_test/batch_test.module \_batch_test_title_callback()

Tests the title on the progress page by performing a batch callback.

1 string reference to '_batch_test_title_callback'
BatchTestController::testTitleBatch in core/modules/system/tests/modules/batch_test/src/Controller/BatchTestController.php
Runs a batch for testing the title shown on the progress page.

File

core/modules/system/tests/modules/batch_test/batch_test.module, line 222

Code

function _batch_test_title_callback() {
    // Because drupalGet() steps through the full progressive batch before
    // returning control to the test function, we cannot test that the correct
    // title is being used on the batch processing page by viewing that page
    // directly. Instead, we save the title being used in a variable here, so
    // that it can be loaded and inspected in the thread running the test.
    $request = \Drupal::request();
    $route_match = \Drupal::routeMatch();
    $title = \Drupal::service('title_resolver')->getTitle($request, $route_match->getRouteObject());
    batch_test_stack($title);
}

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