
| Current Path : /var/www/html1/bbp/web/core/modules/views/tests/src/Functional/Handler/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html1/bbp/web/core/modules/views/tests/src/Functional/Handler/AreaHTTPStatusCodeTest.php |
<?php
namespace Drupal\Tests\views\Functional\Handler;
use Drupal\Tests\views\Functional\ViewTestBase;
use Drupal\views\Views;
/**
* Tests the http_status_code area handler.
*
* @group views
* @see \Drupal\views\Plugin\views\area\HTTPStatusCode
*/
class AreaHTTPStatusCodeTest extends ViewTestBase {
/**
* Views used by this test.
*
* @var array
*/
public static $testViews = ['test_http_status_code'];
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = ['node'];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests the area handler.
*/
public function testHTTPStatusCodeHandler() {
$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);
}
}