function AreaHTTPStatusCodeTest::testHTTPStatusCodeHandler
Same name in other branches
- 9 core/modules/views/tests/src/Functional/Handler/AreaHTTPStatusCodeTest.php \Drupal\Tests\views\Functional\Handler\AreaHTTPStatusCodeTest::testHTTPStatusCodeHandler()
- 8.9.x core/modules/views/tests/src/Functional/Handler/AreaHTTPStatusCodeTest.php \Drupal\Tests\views\Functional\Handler\AreaHTTPStatusCodeTest::testHTTPStatusCodeHandler()
- 11.x core/modules/views/tests/src/Functional/Handler/AreaHTTPStatusCodeTest.php \Drupal\Tests\views\Functional\Handler\AreaHTTPStatusCodeTest::testHTTPStatusCodeHandler()
Tests the area handler.
File
-
core/
modules/ views/ tests/ src/ Functional/ Handler/ AreaHTTPStatusCodeTest.php, line 38
Class
- AreaHTTPStatusCodeTest
- Tests the http_status_code area handler.
Namespace
Drupal\Tests\views\Functional\HandlerCode
public function testHTTPStatusCodeHandler() : void {
$this->drupalGet('test-http-status-code');
$this->assertSession()
->statusCodeEquals(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->assertSession()
->statusCodeEquals(418);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.