You are here

protected function XMLExportViewsDataExportTests::getExportView in Views data export 7.4

Same name and namespace in other branches
  1. 7.3 tests/xml_export.test \XMLExportViewsDataExportTests::getExportView()

Get a very basic view and expected output for this style.

Return value

An array containing two elements:

  • A View object, for the export.
  • The expected out from that view, if is was executed without further changes.

Overrides ViewsDataExportSimpleExportTest::getExportView

File

tests/xml_export.test, line 21

Class

XMLExportViewsDataExportTests

Code

protected function getExportView($path = 'vde_test') {

  // Create the basic view.
  $view = $this
    ->getBasicExportView();
  $display = $view
    ->new_display('views_data_export', 'Data export', 'vde_test');
  $display
    ->override_option('style_plugin', 'views_data_export_xml');
  $display
    ->override_option('path', $path);
  $style_options = array(
    'exporter_options' => array(
      'root_node' => 'views_tests',
      'item_node' => 'views_test',
    ),
  );
  $display
    ->override_option('style_options', $style_options);
  $expected = '<?xml version="1.0" encoding="UTF-8"?>
<views_tests>
  <views_test>
    <ID>1</ID>
    <Name>John</Name>
    <Age>25</Age>
  </views_test>
  <views_test>
    <ID>2</ID>
    <Name>George</Name>
    <Age>27</Age>
  </views_test>
  <views_test>
    <ID>3</ID>
    <Name>Ringo</Name>
    <Age>28</Age>
  </views_test>
  <views_test>
    <ID>4</ID>
    <Name>Paul</Name>
    <Age>26</Age>
  </views_test>
  <views_test>
    <ID>5</ID>
    <Name>Meredith</Name>
    <Age>30</Age>
  </views_test>
</views_tests>';
  return array(
    &$view,
    $expected,
  );
}