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); } }