diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php index e0a3495..bdf4916 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php @@ -50,45 +50,46 @@ protected function setUp() { * Tests the general renderering of styles. */ public function testStyle() { + // This run use the test row plugin and render with it. $view = views_get_view('test_view'); $view->setDisplay(); $style = $view->display_handler->getOption('style'); $style['type'] = 'test_style'; $view->display_handler->setOption('style', $style); + $row = $view->display_handler->getOption('row'); + $row['type'] = 'test_row'; + $view->display_handler->setOption('row', $row); $view->initDisplay(); $view->initStyle(); - $this->assertTrue($view->style_plugin instanceof StyleTestPlugin, 'Make sure the right style plugin class is loaded.'); + // Reinitialize the style as it supports row plugins now. + $view->style_plugin->init($view, $view->display_handler); + $this->assertTrue($view->rowPlugin instanceof RowTest, 'Make sure the right row plugin class is loaded.'); $random_text = $this->randomName(); - // Set some custom text to the output and make sure that this value is - // rendered. - $view->style_plugin->setOutput($random_text); + $view->rowPlugin->setOutput($random_text); + $output = $view->preview(); $output = drupal_render($output); - $this->assertTrue(strpos($output, $random_text) !== FALSE, 'Take sure that the rendering of the style plugin appears in the output of the view.'); + $this->assertTrue(strpos($output, $random_text) !== FALSE, 'Take sure that the rendering of the row plugin appears in the output of the view.'); - // This run use the test row plugin and render with it. + // Test without row plugin support. $view = views_get_view('test_view'); $view->setDisplay(); $style = $view->display_handler->getOption('style'); $style['type'] = 'test_style'; $view->display_handler->setOption('style', $style); - $row = $view->display_handler->getOption('row'); - $row['type'] = 'test_row'; - $view->display_handler->setOption('row', $row); $view->initDisplay(); $view->initStyle(); - $view->style_plugin->setUsesRowPlugin(TRUE); - // Reinitialize the style as it supports row plugins now. - $view->style_plugin->init($view, $view->display_handler); - $this->assertTrue($view->rowPlugin instanceof RowTest, 'Make sure the right row plugin class is loaded.'); + $view->style_plugin->setUsesRowPlugin(FALSE); + $this->assertTrue($view->style_plugin instanceof StyleTestPlugin, 'Make sure the right style plugin class is loaded.'); $random_text = $this->randomName(); - $view->rowPlugin->setOutput($random_text); - + // Set some custom text to the output and make sure that this value is + // rendered. + $view->style_plugin->setOutput($random_text); $output = $view->preview(); $output = drupal_render($output); - $this->assertTrue(strpos($output, $random_text) !== FALSE, 'Take sure that the rendering of the row plugin appears in the output of the view.'); + $this->assertTrue(strpos($output, $random_text) !== FALSE, 'Take sure that the rendering of the style plugin appears in the output of the view.'); } function testGrouping() { diff --git a/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/style/StyleTest.php b/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/style/StyleTest.php index 8c94280..3df17c7 100644 --- a/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/style/StyleTest.php +++ b/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/style/StyleTest.php @@ -63,10 +63,6 @@ public function buildOptionsForm(&$form, &$form_state) { ); } - function usesRowPlugin() { - return parent::usesRowPlugin(); - } - /** * Sets the usesRowPlugin property. *