public function StyleSerializerTest::testSiteMaintenance in Drupal 10
Same name and namespace in other branches
- 8 core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php \Drupal\Tests\rest\Functional\Views\StyleSerializerTest::testSiteMaintenance()
- 9 core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php \Drupal\Tests\rest\Functional\Views\StyleSerializerTest::testSiteMaintenance()
Verifies site maintenance mode functionality.
File
- core/
modules/ rest/ tests/ src/ Functional/ Views/ StyleSerializerTest.php, line 256
Class
- StyleSerializerTest
- Tests the serializer style plugin.
Namespace
Drupal\Tests\rest\Functional\ViewsCode
public function testSiteMaintenance() {
$view = Views::getView('test_serializer_display_field');
$view
->initDisplay();
$this
->executeView($view);
// Set the site to maintenance mode.
$this->container
->get('state')
->set('system.maintenance_mode', TRUE);
$this
->drupalGet('test/serialize/entity', [
'query' => [
'_format' => 'json',
],
]);
// Verify that the endpoint is unavailable for anonymous users.
$this
->assertSession()
->statusCodeEquals(503);
}