You are here

public function AreaHTTPStatusCodeTest::testHTTPStatusCodeHandler in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/Handler/AreaHTTPStatusCodeTest.php \Drupal\views\Tests\Handler\AreaHTTPStatusCodeTest::testHTTPStatusCodeHandler()

Tests the area handler.

File

core/modules/views/src/Tests/Handler/AreaHTTPStatusCodeTest.php, line 37
Contains \Drupal\views\Tests\Handler\AreaHTTPStatusCodeTest.

Class

AreaHTTPStatusCodeTest
Tests the http_status_code area handler.

Namespace

Drupal\views\Tests\Handler

Code

public function testHTTPStatusCodeHandler() {
  $this
    ->drupalGet('test-http-status-code');
  $this
    ->assertResponse(200);

  // Change the HTTP status code to 418.
  $view = Views::getView('test_http_status_code');
  $display =& $view->storage
    ->getDisplay('default');
  $display['display_options']['empty']['http_status_code']['status_code'] = 418;
  $view
    ->save();

  // Test that the HTTP response is "I'm a teapot".
  $this
    ->drupalGet('test-http-status-code');
  $this
    ->assertResponse(418);
}