diff --git a/core/modules/views/tests/themes/views_test_theme/templates/views-view-field.html.twig b/core/modules/views/tests/themes/views_test_theme/templates/views-view-field.html.twig new file mode 100644 index 0000000..682d4db --- /dev/null +++ b/core/modules/views/tests/themes/views_test_theme/templates/views-view-field.html.twig @@ -0,0 +1,11 @@ +{# +/** + * @file + * Theme override to display all the fields in a views row. + * + * The reason for this template is to override the theme function provided by + * views. + */ +#} +{% include '@views/views-view-field.html.twig' %} +Use posts instead of twigs to protect your llamas from escaping the field. diff --git a/core/modules/views_ui/src/Tests/CustomBooleanTest.php b/core/modules/views_ui/src/Tests/CustomBooleanTest.php index 08fbda8..9910973 100644 --- a/core/modules/views_ui/src/Tests/CustomBooleanTest.php +++ b/core/modules/views_ui/src/Tests/CustomBooleanTest.php @@ -101,12 +101,36 @@ public function testCustomOption() { $view = Views::getView('test_view'); $output = $view->preview(); $output = \Drupal::service('renderer')->renderRoot($output); + $this->{$values['test']}(strpos($output, $values['true']), 'Expected custom boolean TRUE value ' . $values['true'] . ' in output for ' . $type); + $this->{$values['test']}(strpos($output, $values['false']), 'Expected custom boolean FALSE value ' . $values['false'] . ' in output for ' . $type); + } + + // Install theme to test with template system. + \Drupal::service('theme_handler')->install(array('views_test_theme')); + + // Make base theme default then test for hook invocations. + $this->config('system.theme') + ->set('default', 'views_test_theme') + ->save(); - $replacements = array('%type' => $type); - $this->{$values['test']}(strpos($output, $values['true']), format_string('Expected custom boolean TRUE value in output for %type.', $replacements)); - $this->{$values['test']}(strpos($output, $values['false']), format_string('Expected custom boolean FALSE value in output for %type', $replacements)); + // Run the same tests on each type. + foreach ($custom_values as $type => $values) { + $options = array( + 'options[type]' => 'custom', + 'options[type_custom_true]' => $values['true'], + 'options[type_custom_false]' => $values['false'], + ); + $this->drupalPostForm('admin/structure/views/nojs/handler/test_view/default/field/age', $options, 'Apply'); + + // Save the view. + $this->drupalPostForm('admin/structure/views/view/test_view', array(), 'Save'); + + $view = Views::getView('test_view'); + $output = $view->preview(); + $output = \Drupal::service('renderer')->renderRoot($output); + $this->{$values['test']}(strpos($output, $values['true']), 'Expected custom boolean TRUE value ' . $values['true'] . ' in output for ' . $type); + $this->{$values['test']}(strpos($output, $values['false']), 'Expected custom boolean FALSE value ' . $values['false'] . ' in output for ' . $type); } } } -