You are here

protected function ViewsDataExportSimpleExportTest::executeAndCompareGivenView in Views data export 7.3

Same name and namespace in other branches
  1. 7.4 tests/base.test \ViewsDataExportSimpleExportTest::executeAndCompareGivenView()

Execute a given view very simply.

This will take a view, and add a display plugin of the correct export type, and then run it and compare it with the expected output.

10 calls to ViewsDataExportSimpleExportTest::executeAndCompareGivenView()
CSVExportViewsDataExportTests::testIconvEncoding in tests/csv_export.test
Test to ensure that Encoding options work.
CSVExportViewsDataExportTests::testKeepHTML in tests/csv_export.test
Test to ensure that HTML tags are kept in CSV files when requested.
CSVExportViewsDataExportTests::testReplaceNewLines in tests/csv_export.test
Test to ensure that all new line characters are replaced in CSV files when requested.
CSVExportViewsDataExportTests::testTrimFields in tests/csv_export.test
Test to ensure that HTML tags are kept in CSV files when requested.
TXTExportViewsDataExportTests::testHideEmptySupport in tests/txt_export.test
Test to check if empty fields are correctly hidden.

... See full list

File

tests/base.test, line 484

Class

ViewsDataExportSimpleExportTest

Code

protected function executeAndCompareGivenView(view $view, $expected, $message = '', $style_options = array()) {
  $path = 'vde_test/' . $this
    ->randomName();
  $display = $view
    ->new_display('views_data_export', 'Data export', 'vde_test');
  $display
    ->override_option('style_plugin', $this
    ->getStylePluginName());
  $display
    ->override_option('style_options', $style_options);
  $display
    ->override_option('path', $path);

  // Save this view so we can hit the path.
  $view
    ->save();

  // Ensure that the menu router system is rebuilt on the next page load.
  variable_set('menu_rebuild_needed', TRUE);
  $this
    ->drupalGet($path);
  $result = $this
    ->drupalGetContent();
  $this
    ->assertExportEqual($result, $expected, $message);
}