public function StyleSerializerTest::testSerializerViewsUI 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::testSerializerViewsUI()
- 9 core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php \Drupal\Tests\rest\Functional\Views\StyleSerializerTest::testSerializerViewsUI()
Tests the views interface for REST export displays.
File
- core/
modules/ rest/ tests/ src/ Functional/ Views/ StyleSerializerTest.php, line 642
Class
- StyleSerializerTest
- Tests the serializer style plugin.
Namespace
Drupal\Tests\rest\Functional\ViewsCode
public function testSerializerViewsUI() {
$this
->drupalLogin($this->adminUser);
// Click the "Update preview button".
$this
->drupalGet('admin/structure/views/view/test_serializer_display_field/edit/rest_export_1');
$this
->submitForm($edit = [], 'Update preview');
$this
->assertSession()
->statusCodeEquals(200);
// Check if we receive the expected result.
$result = $this
->assertSession()
->elementExists('xpath', '//div[@id="views-live-preview"]/pre');
$json_preview = $result
->getText();
$this
->assertSame($json_preview, $this
->drupalGet('test/serialize/field', [
'query' => [
'_format' => 'json',
],
]), 'The expected JSON preview output was found.');
}