class BatchNegotiatorTest

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Batch/BatchNegotiatorTest.php \Drupal\KernelTests\Core\Batch\BatchNegotiatorTest
  2. 10 core/tests/Drupal/KernelTests/Core/Batch/BatchNegotiatorTest.php \Drupal\KernelTests\Core\Batch\BatchNegotiatorTest

Tests the BatchNegotiator.

@group Batch

Hierarchy

Expanded class hierarchy of BatchNegotiatorTest

File

core/tests/Drupal/KernelTests/Core/Batch/BatchNegotiatorTest.php, line 16

Namespace

Drupal\KernelTests\Core\Batch
View source
class BatchNegotiatorTest extends KernelTestBase {
  
  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'system',
  ];
  
  /**
   * Test that the negotiator applies to the batch route.
   */
  public function testApplies() {
    $request = Request::create('/batch');
    // Use the router to enhance the object so that a RouteMatch can be created.
    $this->container
      ->get('router')
      ->matchRequest($request);
    $routeMatch = RouteMatch::createFromRequest($request);
    // The negotiator under test.
    $negotiator = $this->container
      ->get('theme.negotiator.system.batch');
    $this->assertTrue($negotiator->applies($routeMatch));
  }

}

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