public function StyleSerializerTest::testSerializerViewsUI in Drupal 8
Same name and namespace in other branches
- 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 640
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
->drupalPostForm('admin/structure/views/view/test_serializer_display_field/edit/rest_export_1', $edit = [], t('Update preview'));
$this
->assertSession()
->statusCodeEquals(200);
// Check if we receive the expected result.
$result = $this
->xpath('//div[@id="views-live-preview"]/pre');
$json_preview = $result[0]
->getText();
$this
->assertSame($json_preview, $this
->drupalGet('test/serialize/field', [
'query' => [
'_format' => 'json',
],
]), 'The expected JSON preview output was found.');
}