reverted: --- b/core/modules/views/tests/src/Functional/ViewRenderTest.php +++ /dev/null @@ -1,42 +0,0 @@ -enableViewsTestModule(); - } - - - /** - * Tests render functionality. - */ - public function testRender() { - \Drupal::state()->set('views_render.test', 0); - - // Make sure that the rendering just calls the preprocess function once. - $view = Views::getView('test_view_render'); - $output = $view->preview(); - $this->container->get('renderer')->renderRoot($output); - - $this->assertEqual(\Drupal::state()->get('views_render.test'), 1); - } - -} reverted: --- b/core/modules/views/tests/src/Functional/ViewsEscapingTest.php +++ /dev/null @@ -1,84 +0,0 @@ -enableViewsTestModule(); - } - - /** - * Tests for incorrectly escaped markup in the views-view-fields.html.twig. - */ - public function testViewsViewFieldsEscaping() { - // Test with system theme using theme function. - $this->drupalGet('test_page_display_200'); - - // Assert that there are no escaped '<'s characters. - $this->assertNoEscaped('<'); - - // Install theme to test with template system. - \Drupal::service('theme_handler')->install(['views_test_theme']); - - // Make base theme default then test for hook invocations. - $this->config('system.theme') - ->set('default', 'views_test_theme') - ->save(); - $this->assertEqual($this->config('system.theme')->get('default'), 'views_test_theme'); - - $this->drupalGet('test_page_display_200'); - - // Assert that we are using the correct template. - $this->assertText('force', 'The force is strong with this one'); - - // Assert that there are no escaped '<'s characters. - $this->assertNoEscaped('<'); - } - - /** - * Tests for incorrectly escaped markup in a header label on a display table. - */ - public function testViewsFieldHeaderEscaping() { - // Test with a field header label having an html element wrapper. - $this->drupalGet('test_field_header'); - - // Assert that there are no escaped '<'s characters. - $this->assertNoEscaped('<'); - - // Test with a field header label having a XSS test as a wrapper. - $this->drupalGet('test_field_header_xss'); - - // Assert that XSS test is escaped. - $this->assertNoRaw('', 'Harmful tags are escaped in header label.'); - } - -} reverted: --- b/core/modules/views/tests/src/Functional/ViewsFormMultipleTest.php +++ /dev/null @@ -1,60 +0,0 @@ -enableViewsTestModule(); - } - - /** - * {@inheritdoc} - */ - protected function viewsData() { - $data = parent::viewsData(); - $data['views_test_data']['field_form_button_test']['field'] = [ - 'title' => t('Button test'), - 'help' => t('Adds a test form button.'), - 'id' => 'field_form_button_test', - ]; - return $data; - } - - - /** - * Tests the a page with multiple View forms in it. - */ - public function testViewsFormMultiple() { - // Get the test page. - $this->drupalGet('views_test_form_multiple'); - - $this->assertText('Test base form ID with Views forms and arguments.'); - - // Submit the forms, validate argument returned in message set by handler. - // @note There is not a way to specify a specific index for a submit button. So - // the row index returned is always the last occurrence. - $this->getSession()->getPage()->pressButton('edit-field-form-button-test-4--2'); - $this->assertText('The test button at row 4 for test_form_multiple (default) View with args: arg2 was submitted.'); - $this->getSession()->getPage()->pressButton('edit-field-form-button-test-4'); - $this->assertText('The test button at row 4 for test_form_multiple (default) View with args: arg1 was submitted.'); - } - -} reverted: --- b/core/modules/views/tests/src/Functional/ViewsTemplateTest.php +++ /dev/null @@ -1,46 +0,0 @@ -enableViewsTestModule(); - ViewTestData::createTestViews(get_class($this), ['views_test_config']); - } - - /** - * Tests render functionality. - */ - public function testTemplate() { - - // Make sure that the rendering just calls the preprocess function once. - $view = Views::getView('test_view_display_template'); - $output = $view->preview(); - - // Check if we got the rendered output of our template file. - $this->assertTrue(strpos(\Drupal::service('renderer')->renderRoot($output), 'This module defines its own display template.') !== FALSE, 'Display plugin DisplayTemplateTest defines its own template.'); - - } - -} reverted: --- b/core/modules/views/tests/src/Functional/ViewsThemeIntegrationTest.php +++ /dev/null @@ -1,81 +0,0 @@ -enableViewsTestModule(); - } - - /** - * Tests for exceptions and successful execution of hook_views_pre_render() - * and hook_views_post_render() in theme and subtheme. - */ - public function testThemedViewPage() { - - \Drupal::service('theme_handler')->install(['test_basetheme', 'test_subtheme']); - - // Make base theme default then test for hook invocations. - $this->config('system.theme') - ->set('default', 'test_basetheme') - ->save(); - $this->assertEqual($this->config('system.theme')->get('default'), 'test_basetheme'); - - // Make sure a views rendered page is touched. - $this->drupalGet('test_page_display_200'); - - $this->assertRaw("test_basetheme_views_pre_render", "Views title changed by test_basetheme.test_basetheme_views_pre_render"); - $this->assertRaw("test_basetheme_views_post_render", "Views title changed by test_basetheme.test_basetheme_views_post_render"); - - // Make sub theme default to test for hook invocation - // from both sub and base theme. - $this->config('system.theme') - ->set('default', 'test_subtheme') - ->save(); - $this->assertEqual($this->config('system.theme')->get('default'), 'test_subtheme'); - - // Make sure a views rendered page is touched. - $this->drupalGet('test_page_display_200'); - - $this->assertRaw("test_subtheme_views_pre_render", "Views title changed by test_subtheme.test_subtheme_views_pre_render"); - $this->assertRaw("test_subtheme_views_post_render", "Views title changed by test_subtheme.test_subtheme_views_post_render"); - - $this->assertRaw("test_basetheme_views_pre_render", "Views title changed by test_basetheme.test_basetheme_views_pre_render"); - $this->assertRaw("test_basetheme_views_post_render", "Views title changed by test_basetheme.test_basetheme_views_post_render"); - - $this->assertRaw('' . count($this->dataSet()) . ' items found.', 'Views group title added by test_subtheme.test_subtheme_views_post_render'); - } - -} diff -u b/core/modules/views/tests/src/Kernel/Handler/AreaEmptyTest.php b/core/modules/views/tests/src/Kernel/Handler/AreaEmptyTest.php --- b/core/modules/views/tests/src/Kernel/Handler/AreaEmptyTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/AreaEmptyTest.php @@ -18,23 +18,59 @@ class AreaEmptyTest extends ViewsKernelTestBase { /** + * {@inheritdoc} + */ + public static $modules = ['node']; + + /** + * {@inheritdoc} + */ + protected function setUp($import_test_views = TRUE) { + parent::setUp(); + $this->installEntitySchema('node'); + } + + /** + * {@inheritdoc} + */ + protected function viewsData() { + $data = parent::viewsData(); + $data['views']['test_example'] = [ + 'title' => 'Test Example area', + 'help' => 'A area handler which just exists for tests.', + 'area' => [ + 'id' => 'test_example' + ] + ]; + + return $data; + } + + /** * Views used by this test. * * @var array */ - public static $testViews = ['test_area_messages']; + public static $testViews = ['test_example_area']; /** * Tests that the header and footer areas are not rendered if empty. */ public function testRenderEmptyHeaderFooter() { - $view = Views::getView('test_area_messages'); + $view = Views::getView('test_example_area'); $view->initHandlers(); // Set example empty text. - $view->empty['test_example']->options['string'] = '

' . $this->randomMachineName() . '

'; + $empty_text = $this->randomMachineName(); + $empty_header = $this->randomMachineName(); + $empty_footer = $this->randomMachineName(); - $xpath = '//div[contains(@class, :class)]'; + // Set empty text. + $view->empty['test_example']->options['string'] = '

' . $empty_text . '

'; + // Set example header text. + $view->header['test_example']->options['string'] = '

' . $empty_header . '

'; + // Set example footer text. + $view->footer['test_example']->options['string'] = '

' . $empty_footer . '

'; // Verify that the empty header and footer sections have not been rendered. $view->setDisplay('default'); @@ -42,15 +78,12 @@ $output = $view->render(); $output = \Drupal::service('renderer')->renderRoot($output); $this->setRawContent($output); - $this->assertEqual(0, count($this->xpath($xpath, [':class' => 'view-header']))); - $this->assertEqual(0, count($this->xpath($xpath, [':class' => 'view-footer']))); + $this->assertText($empty_text); + $this->assertNoText($empty_header); + $this->assertNoText($empty_footer); - // Set example header text. - $view->header['test_example']->options['string'] = '

' . $this->randomMachineName() . '

'; + // Enable displaying the header and footer when the View is empty. $view->header['test_example']->options['empty'] = TRUE; - - // Set example footer text. - $view->footer['test_example']->options['string'] = '

' . $this->randomMachineName() . '

'; $view->footer['test_example']->options['empty'] = TRUE; // Verify that the header and footer sections have been rendered. @@ -58,8 +91,8 @@ $output = $view->render(); $output = \Drupal::service('renderer')->renderRoot($output); $this->setRawContent($output); - $this->assertEqual(1, count($this->xpath($xpath, [':class' => 'view-header']))); - $this->assertEqual(1, count($this->xpath($xpath, [':class' => 'view-footer']))); + $this->assertText($empty_header); + $this->assertText($empty_footer); } } only in patch2: unchanged: --- a/core/modules/views/src/Tests/ViewRenderTest.php +++ b/core/modules/views/tests/src/Functional/ViewRenderTest.php @@ -1,6 +1,6 @@ enableViewsTestModule(); } only in patch2: unchanged: --- a/core/modules/views/src/Tests/ViewsEscapingTest.php +++ b/core/modules/views/tests/src/Functional/ViewsEscapingTest.php @@ -1,6 +1,6 @@ enableViewsTestModule(); } only in patch2: unchanged: --- a/core/modules/views/src/Tests/ViewsFormMultipleTest.php +++ b/core/modules/views/tests/src/Functional/ViewsFormMultipleTest.php @@ -1,6 +1,6 @@ enableViewsTestModule(); } @@ -51,9 +51,9 @@ public function testViewsFormMultiple() { // Submit the forms, validate argument returned in message set by handler. // @note There is not a way to specify a specific index for a submit button. So // the row index returned is always the last occurrence. - $this->drupalPostForm(NULL, [], t('Test Button'), [], [], 'views-form-test-form-multiple-default-arg2'); + $this->getSession()->getPage()->pressButton('edit-field-form-button-test-4--2'); $this->assertText('The test button at row 4 for test_form_multiple (default) View with args: arg2 was submitted.'); - $this->drupalPostForm(NULL, [], t('Test Button'), [], [], 'views-form-test-form-multiple-default-arg1'); + $this->getSession()->getPage()->pressButton('edit-field-form-button-test-4'); $this->assertText('The test button at row 4 for test_form_multiple (default) View with args: arg1 was submitted.'); } only in patch2: unchanged: --- a/core/modules/views/src/Tests/ViewsTemplateTest.php +++ b/core/modules/views/tests/src/Functional/ViewsTemplateTest.php @@ -1,7 +1,8 @@ enableViewsTestModule(); only in patch2: unchanged: --- a/core/modules/views/src/Tests/ViewsThemeIntegrationTest.php +++ b/core/modules/views/tests/src/Functional/ViewsThemeIntegrationTest.php @@ -1,6 +1,6 @@ enableViewsTestModule(); }