class AreaHTTPStatusCodeTest
Same name and namespace in other branches
- 11.x core/modules/views/tests/src/Functional/Handler/AreaHTTPStatusCodeTest.php \Drupal\Tests\views\Functional\Handler\AreaHTTPStatusCodeTest
Tests the http_status_code area handler.
@group views
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\views\Functional\ViewTestBase uses \Drupal\views\Tests\ViewResultAssertionTrait implements \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\views\Functional\Handler\AreaHTTPStatusCodeTest implements \Drupal\Tests\views\Functional\ViewTestBase
- class \Drupal\Tests\views\Functional\ViewTestBase uses \Drupal\views\Tests\ViewResultAssertionTrait implements \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of AreaHTTPStatusCodeTest
See also
\Drupal\views\Plugin\views\area\HTTPStatusCode
File
-
core/
modules/ views/ tests/ src/ Functional/ Handler/ AreaHTTPStatusCodeTest.php, line 14
Namespace
Drupal\Tests\views\Functional\HandlerView source
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);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.