3 namespace Drupal\Tests\views\Functional\Handler;
5 use Drupal\Tests\views\Functional\ViewTestBase;
6 use Drupal\views\Views;
9 * Tests the http_status_code area handler.
12 * @see \Drupal\views\Plugin\views\area\HTTPStatusCode
14 class AreaHTTPStatusCodeTest extends ViewTestBase {
17 * Views used by this test.
21 public static $testViews = ['test_http_status_code'];
28 public static $modules = ['node'];
31 * Tests the area handler.
33 public function testHTTPStatusCodeHandler() {
34 $this->drupalGet('test-http-status-code');
35 $this->assertResponse(200);
37 // Change the HTTP status code to 418.
38 $view = Views::getView('test_http_status_code');
39 $display = &$view->storage->getDisplay('default');
40 $display['display_options']['empty']['http_status_code']['status_code'] = 418;
43 // Test that the HTTP response is "I'm a teapot".
44 $this->drupalGet('test-http-status-code');
45 $this->assertResponse(418);