WaitTerminateTestTrait.php

Same filename in other branches
  1. 10 core/tests/Drupal/Tests/WaitTerminateTestTrait.php

Namespace

Drupal\Tests

File

core/tests/Drupal/Tests/WaitTerminateTestTrait.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests;


/**
 * Provides a method to enforce that requests will wait for the terminate event.
 */
trait WaitTerminateTestTrait {
    
    /**
     * Specify that subsequent requests must wait for the terminate event.
     *
     * The terminate event is fired after a response is sent to the user agent.
     * Tests with assertions which operate on data computed during the terminate
     * event need to enable this.
     */
    protected function setWaitForTerminate() {
        $this->container
            ->get('state')
            ->set('drupal.test_wait_terminate', TRUE);
    }

}

Traits

Title Deprecated Summary
WaitTerminateTestTrait Provides a method to enforce that requests will wait for the terminate event.

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