function CommandLineOrUnsafeMethodTest::setUp

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/PageCache/CommandLineOrUnsafeMethodTest.php \Drupal\Tests\Core\PageCache\CommandLineOrUnsafeMethodTest::setUp()
  2. 8.9.x core/tests/Drupal/Tests/Core/PageCache/CommandLineOrUnsafeMethodTest.php \Drupal\Tests\Core\PageCache\CommandLineOrUnsafeMethodTest::setUp()
  3. 10 core/tests/Drupal/Tests/Core/PageCache/CommandLineOrUnsafeMethodTest.php \Drupal\Tests\Core\PageCache\CommandLineOrUnsafeMethodTest::setUp()

Overrides UnitTestCase::setUp

File

core/tests/Drupal/Tests/Core/PageCache/CommandLineOrUnsafeMethodTest.php, line 27

Class

CommandLineOrUnsafeMethodTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21PageCache%21RequestPolicy%21CommandLineOrUnsafeMethod.php/class/CommandLineOrUnsafeMethod/11.x" title="Reject when running from the command line or when HTTP method is not safe." class="local">\Drupal\Core\PageCache\RequestPolicy\CommandLineOrUnsafeMethod</a> @group PageCache

Namespace

Drupal\Tests\Core\PageCache

Code

protected function setUp() : void {
    parent::setUp();
    // Note that it is necessary to partially mock the class under test in
    // order to disable the isCli-check.
    $this->policy = $this->getMockBuilder('Drupal\\Core\\PageCache\\RequestPolicy\\CommandLineOrUnsafeMethod')
        ->onlyMethods([
        'isCli',
    ])
        ->getMock();
}

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