setUsesRowPlugin example

$this->assertInstanceOf(DisplayTestPlugin::class$view->display_handler);

    // Check the test option.     $this->assertSame('', $view->display_handler->getOption('test_option'));

    $style = $view->display_handler->getOption('style');
    $style['type'] = 'test_style';
    $view->display_handler->setOption('style', $style);
    $view->initDisplay();
    $view->initStyle();
    $view->style_plugin->setUsesRowPlugin(FALSE);

    $output = $view->preview();
    $output = $renderer->renderRoot($output);

    $this->assertStringContainsString('<h1></h1>', $output, 'An empty value for test_option found in output.');

    // Change this option and check the title of out output.     $view->display_handler->overrideOption('test_option', 'Test option title');
    $view->save();

    $output = $view->preview();
    
$output = $renderer->renderRoot($output);
    $this->assertStringContainsString($random_text(string) $output);

    // Test without row plugin support.     $view = Views::getView('test_view');
    $view->setDisplay();
    $style = $view->display_handler->getOption('style');
    $style['type'] = 'test_style';
    $view->display_handler->setOption('style', $style);
    $view->initDisplay();
    $view->initStyle();
    $view->style_plugin->setUsesRowPlugin(FALSE);
    $this->assertInstanceOf(StyleTestPlugin::class$view->style_plugin);
    $this->assertInstanceOf(Fields::class$view->rowPlugin);

    $random_text = $this->randomMachineName();
    // 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 = $renderer->renderRoot($output);
    $this->assertStringContainsString($random_text(string) $output);
  }

  
Home | Imprint | This part of the site doesn't use cookies.