AreaHTTPStatusCodeTest.php in Drupal 9
File
core/modules/views/tests/src/Functional/Handler/AreaHTTPStatusCodeTest.php
View source
<?php
namespace Drupal\Tests\views\Functional\Handler;
use Drupal\Tests\views\Functional\ViewTestBase;
use Drupal\views\Views;
class AreaHTTPStatusCodeTest extends ViewTestBase {
public static $testViews = [
'test_http_status_code',
];
protected static $modules = [
'node',
];
protected $defaultTheme = 'stark';
public function testHTTPStatusCodeHandler() {
$this
->drupalGet('test-http-status-code');
$this
->assertSession()
->statusCodeEquals(200);
$view = Views::getView('test_http_status_code');
$display =& $view->storage
->getDisplay('default');
$display['display_options']['empty']['http_status_code']['status_code'] = 418;
$view
->save();
$this
->drupalGet('test-http-status-code');
$this
->assertSession()
->statusCodeEquals(418);
}
}