trait WaitTerminateTestTrait

Same name in other branches
  1. 11.x core/tests/Drupal/Tests/WaitTerminateTestTrait.php \Drupal\Tests\WaitTerminateTestTrait

Provides a method to enforce that requests will wait for the terminate event.

Hierarchy

7 files declare their use of WaitTerminateTestTrait
ConfigurableLanguageManagerTest.php in core/modules/language/tests/src/Functional/ConfigurableLanguageManagerTest.php
CronRunTest.php in core/modules/system/tests/src/Functional/System/CronRunTest.php
DisplayFeedTranslationTest.php in core/modules/views/tests/src/Functional/Plugin/DisplayFeedTranslationTest.php
LocaleLocaleLookupTest.php in core/modules/locale/tests/src/Functional/LocaleLocaleLookupTest.php
NodeTest.php in core/modules/jsonapi/tests/src/Functional/NodeTest.php

... See full list

File

core/tests/Drupal/Tests/WaitTerminateTestTrait.php, line 10

Namespace

Drupal\Tests
View source
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);
    }

}

Members

Title Sort descending Modifiers Object type Summary
WaitTerminateTestTrait::setWaitForTerminate protected function Specify that subsequent requests must wait for the terminate event.

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