You are here

protected function UcAddressesViewsTestCase::createAccessFiltersView in Ubercart Addresses 7

Same name and namespace in other branches
  1. 6.2 tests/uc_addresses.views.test \UcAddressesViewsTestCase::createAccessFiltersView()

Creates a View for access filters test.

Return value

object The created View.

1 call to UcAddressesViewsTestCase::createAccessFiltersView()
UcAddressesViewsTestCase::testAccessFilters in tests/uc_addresses.views.test
Tests if the address access filters work as expected.

File

tests/uc_addresses.views.test, line 516
Test cases for Views integration.

Class

UcAddressesViewsTestCase
Test cases for Views integration.

Code

protected function createAccessFiltersView() {
  $view = new view();
  $view->name = 'uc_addresses_access_filters';
  $view->description = 'Used to test if address access filters work as expected.';
  $view->tag = 'default';
  $view->base_table = 'uc_addresses';
  $view->human_name = 'uc_addresses_access_filters';
  $view->core = 7;
  $view->api_version = '3.0';
  $view->disabled = FALSE;

  /* Edit this to true to make a default view disabled initially */

  /* Display: Master */
  $handler = $view
    ->new_display('default', 'Master', 'default');
  $handler->display->display_options['use_more_always'] = FALSE;
  $handler->display->display_options['access']['type'] = 'none';
  $handler->display->display_options['cache']['type'] = 'none';
  $handler->display->display_options['query']['type'] = 'views_query';
  $handler->display->display_options['exposed_form']['type'] = 'basic';
  $handler->display->display_options['pager']['type'] = 'none';
  $handler->display->display_options['pager']['options']['offset'] = '0';
  $handler->display->display_options['style_plugin'] = 'default';
  $handler->display->display_options['row_plugin'] = 'fields';

  /* Field: Ubercart Addresses: Address ID */
  $handler->display->display_options['fields']['aid']['id'] = 'aid';
  $handler->display->display_options['fields']['aid']['table'] = 'uc_addresses';
  $handler->display->display_options['fields']['aid']['field'] = 'aid';

  /* Field: Ubercart Addresses: Address name */
  $handler->display->display_options['fields']['address_name']['id'] = 'address_name';
  $handler->display->display_options['fields']['address_name']['table'] = 'uc_addresses';
  $handler->display->display_options['fields']['address_name']['field'] = 'address_name';

  /* Display: uc_addresses_view_access */
  $handler = $view
    ->new_display('page', 'uc_addresses_view_access', 'page_1');
  $handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
  $handler->display->display_options['defaults']['filter_groups'] = FALSE;
  $handler->display->display_options['defaults']['filters'] = FALSE;

  /* Filter criterion: Ubercart Addresses: Access */
  $handler->display->display_options['filters']['access_view']['id'] = 'access_view';
  $handler->display->display_options['filters']['access_view']['table'] = 'uc_addresses';
  $handler->display->display_options['filters']['access_view']['field'] = 'access_view';
  $handler->display->display_options['filters']['access_view']['value'] = '1';
  $handler->display->display_options['path'] = 'uc_addresses/view';

  /* Display: uc_addresses_edit_access */
  $handler = $view
    ->new_display('page', 'uc_addresses_edit_access', 'page_2');
  $handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
  $handler->display->display_options['defaults']['filter_groups'] = FALSE;
  $handler->display->display_options['defaults']['filters'] = FALSE;

  /* Filter criterion: Ubercart Addresses: Edit access */
  $handler->display->display_options['filters']['access_edit']['id'] = 'access_edit';
  $handler->display->display_options['filters']['access_edit']['table'] = 'uc_addresses';
  $handler->display->display_options['filters']['access_edit']['field'] = 'access_edit';
  $handler->display->display_options['filters']['access_edit']['value'] = '1';
  $handler->display->display_options['path'] = 'uc_addresses/edit';

  /* Display: uc_addresses_delete_access */
  $handler = $view
    ->new_display('page', 'uc_addresses_delete_access', 'page_3');
  $handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
  $handler->display->display_options['defaults']['filter_groups'] = FALSE;
  $handler->display->display_options['defaults']['filters'] = FALSE;

  /* Filter criterion: Ubercart Addresses: Delete access */
  $handler->display->display_options['filters']['access_delete']['id'] = 'access_delete';
  $handler->display->display_options['filters']['access_delete']['table'] = 'uc_addresses';
  $handler->display->display_options['filters']['access_delete']['field'] = 'access_delete';
  $handler->display->display_options['filters']['access_delete']['value'] = '1';
  $handler->display->display_options['path'] = 'uc_addresses/delete';

  // Save View.
  $view
    ->save();
  return $view;
}