You are here

protected function ViewsDataExportSimpleExportTest::getHideIfEmptyExportView in Views data export 7.4

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

Get a view that's our basic view, but with hide if empty/0 support.

We add this to the 'age' field.

2 calls to ViewsDataExportSimpleExportTest::getHideIfEmptyExportView()
TXTExportViewsDataExportTests::testHideEmptySupport in tests/txt_export.test
Test to check if empty fields are correctly hidden.
XMLExportViewsDataExportTests::testHideEmptySupport in tests/xml_export.test
Test to check if empty fields are correctly hidden.

File

tests/base.test, line 443

Class

ViewsDataExportSimpleExportTest

Code

protected function getHideIfEmptyExportView() {
  $view = $this
    ->getBasicExportView();
  $display = $view->display['default']->handler;
  $display
    ->override_option('fields', array(
    'id' => array(
      'id' => 'id',
      'table' => 'views_test',
      'field' => 'id',
      'relationship' => 'none',
    ),
    'name' => array(
      'id' => 'name',
      'table' => 'views_test',
      'field' => 'name',
      'relationship' => 'none',
      // Hide their name if its empty.
      'hide_empty' => TRUE,
      // But we don't hide it if it's: 0.
      'empty_zero' => FALSE,
    ),
    'age' => array(
      'id' => 'age',
      'table' => 'views_test',
      'field' => 'age',
      'relationship' => 'none',
      // Hide their age if it's empty.
      'hide_empty' => TRUE,
      'empty_zero' => TRUE,
    ),
  ));
  return $view;
}