$this->
submitForm($edit, 'Apply'
);
$this->
drupalGet($style_options_url);
$this->
assertSession()->
fieldValueEquals('style_options[test_option]',
$random_name);
$this->
drupalGet($view_edit_url);
$this->
submitForm([], 'Save'
);
$this->
assertSession()->
linkExists('Test style plugin', 0, 'Make sure the test style plugin is shown in the UI'
);
$view = Views::
getView($view_name);
$view->
initDisplay();
$style =
$view->display_handler->
getOption('style'
);
$this->
assertEquals('test_style',
$style['type'
], 'Make sure that the test_style got saved as used style plugin.'
);
$this->
assertEquals($random_name,
$style['options'
]['test_option'
], 'Make sure that the custom settings field got saved as expected.'
);
// Test that fields are working correctly in the UI for style plugins when
// a field row plugin is selected.
$this->
drupalGet("admin/structure/views/view/{
$view_name}/edit"
);
$this->
submitForm([], 'Add Page'
);
$this->
drupalGet("admin/structure/views/nojs/display/{
$view_name}/page_1/row"
);
$this->
submitForm(['row[type]' => 'fields'
], 'Apply'
);
// If fields are being used this text will not be shown.
$this->
assertSession()->
pageTextNotContains('The selected style or row format does not use fields.'
);
}