You are here

public function CommandLineOrUnsafeMethodTest::testIsCli in Drupal 8

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

Asserts that check() returns DENY if running from the command line.

@covers ::check

File

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

Class

CommandLineOrUnsafeMethodTest
@coversDefaultClass \Drupal\Core\PageCache\RequestPolicy\CommandLineOrUnsafeMethod @group PageCache

Namespace

Drupal\Tests\Core\PageCache

Code

public function testIsCli() {
  $this->policy
    ->expects($this
    ->once())
    ->method('isCli')
    ->will($this
    ->returnValue(TRUE));
  $request = Request::create('/', 'GET');
  $actual_result = $this->policy
    ->check($request);
  $this
    ->assertSame(RequestPolicyInterface::DENY, $actual_result);
}