public function StyleSerializerTest::testFieldRawOutput in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/rest/src/Tests/Views/StyleSerializerTest.php \Drupal\rest\Tests\Views\StyleSerializerTest::testFieldRawOutput()
Tests the raw output options for row field rendering.
File
- core/
modules/ rest/ src/ Tests/ Views/ StyleSerializerTest.php, line 438 - Contains \Drupal\rest\Tests\Views\StyleSerializerTest.
Class
- StyleSerializerTest
- Tests the serializer style plugin.
Namespace
Drupal\rest\Tests\ViewsCode
public function testFieldRawOutput() {
$this
->drupalLogin($this->adminUser);
// Test the UI settings for adding field ID aliases.
$this
->drupalGet('admin/structure/views/view/test_serializer_display_field/edit/rest_export_1');
$row_options = 'admin/structure/views/nojs/display/test_serializer_display_field/rest_export_1/row_options';
$this
->assertLinkByHref($row_options);
// Test an empty string for an alias, this should not be used. This also
// tests that the form can be submitted with no aliases.
$this
->drupalPostForm($row_options, array(
'row_options[field_options][created][raw_output]' => '1',
), t('Apply'));
$this
->drupalPostForm(NULL, array(), t('Save'));
$view = Views::getView('test_serializer_display_field');
$view
->setDisplay('rest_export_1');
$this
->executeView($view);
// Just test the raw 'created' value against each row.
foreach ($this
->drupalGetJSON('test/serialize/field') as $index => $values) {
$this
->assertIdentical($values['created'], $view->result[$index]->views_test_data_created, 'Expected raw created value found.');
}
}