function StyleSerializerTest::testSerializerViewsUI
Same name in other branches
- 8.9.x 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 645
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.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.