You are here

public function UcAddressesViewsTestCase::createArgumentValidatorView in Ubercart Addresses 7

Creates a View for Argument validator test.

Return value

object The created View.

1 call to UcAddressesViewsTestCase::createArgumentValidatorView()
UcAddressesViewsTestCase::testArgumentValidatorPlugins in tests/uc_addresses.views.test
Tests if the argument validator plugins work as expected.

File

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

Class

UcAddressesViewsTestCase
Test cases for Views integration.

Code

public function createArgumentValidatorView() {
  $view = new view();
  $view->name = 'uc_addresses_argument_validator';
  $view->description = 'Used to test if display access restrictions work as expected.';
  $view->tag = 'default';
  $view->base_table = 'uc_addresses';
  $view->human_name = 'uc_addresses_argument_validator';
  $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', 'uc_addresses_view_access');
  $handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
  $handler->display->display_options['defaults']['arguments'] = FALSE;

  /* Contextual filter: Ubercart Addresses: User ID */
  $handler->display->display_options['arguments']['uid']['id'] = 'uid';
  $handler->display->display_options['arguments']['uid']['table'] = 'uc_addresses';
  $handler->display->display_options['arguments']['uid']['field'] = 'uid';
  $handler->display->display_options['arguments']['uid']['default_action'] = 'not found';
  $handler->display->display_options['arguments']['uid']['default_argument_type'] = 'fixed';
  $handler->display->display_options['arguments']['uid']['summary']['number_of_records'] = '0';
  $handler->display->display_options['arguments']['uid']['summary']['format'] = 'default_summary';
  $handler->display->display_options['arguments']['uid']['summary_options']['items_per_page'] = '25';
  $handler->display->display_options['arguments']['uid']['specify_validation'] = TRUE;
  $handler->display->display_options['arguments']['uid']['validate']['type'] = 'uc_addresses_user_address_access';
  $handler->display->display_options['arguments']['uid']['validate']['fail'] = 'access denied';

  /* Contextual filter: Ubercart Addresses: Address ID */
  $handler->display->display_options['arguments']['aid']['id'] = 'aid';
  $handler->display->display_options['arguments']['aid']['table'] = 'uc_addresses';
  $handler->display->display_options['arguments']['aid']['field'] = 'aid';
  $handler->display->display_options['arguments']['aid']['default_argument_type'] = 'fixed';
  $handler->display->display_options['arguments']['aid']['summary']['number_of_records'] = '0';
  $handler->display->display_options['arguments']['aid']['summary']['format'] = 'default_summary';
  $handler->display->display_options['arguments']['aid']['summary_options']['items_per_page'] = '25';
  $handler->display->display_options['arguments']['aid']['specify_validation'] = TRUE;
  $handler->display->display_options['arguments']['aid']['validate']['type'] = 'uc_addresses_address_access';
  $handler->display->display_options['arguments']['aid']['validate']['fail'] = 'access denied';
  $handler->display->display_options['path'] = 'user/%/uc_addresses_argument_validator_view';
  $handler->display->display_options['menu']['type'] = 'tab';
  $handler->display->display_options['menu']['title'] = 'AddressBookView';
  $handler->display->display_options['menu']['weight'] = '0';
  $handler->display->display_options['menu']['context'] = 0;

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

  /* Contextual filter: Ubercart Addresses: User ID */
  $handler->display->display_options['arguments']['uid']['id'] = 'uid';
  $handler->display->display_options['arguments']['uid']['table'] = 'uc_addresses';
  $handler->display->display_options['arguments']['uid']['field'] = 'uid';
  $handler->display->display_options['arguments']['uid']['default_action'] = 'not found';
  $handler->display->display_options['arguments']['uid']['default_argument_type'] = 'fixed';
  $handler->display->display_options['arguments']['uid']['summary']['number_of_records'] = '0';
  $handler->display->display_options['arguments']['uid']['summary']['format'] = 'default_summary';
  $handler->display->display_options['arguments']['uid']['summary_options']['items_per_page'] = '25';
  $handler->display->display_options['arguments']['uid']['specify_validation'] = TRUE;
  $handler->display->display_options['arguments']['uid']['validate']['type'] = 'uc_addresses_user_address_access';
  $handler->display->display_options['arguments']['uid']['validate_options']['access_type'] = 'edit';
  $handler->display->display_options['arguments']['uid']['validate']['fail'] = 'access denied';

  /* Contextual filter: Ubercart Addresses: Address ID */
  $handler->display->display_options['arguments']['aid']['id'] = 'aid';
  $handler->display->display_options['arguments']['aid']['table'] = 'uc_addresses';
  $handler->display->display_options['arguments']['aid']['field'] = 'aid';
  $handler->display->display_options['arguments']['aid']['default_argument_type'] = 'fixed';
  $handler->display->display_options['arguments']['aid']['summary']['number_of_records'] = '0';
  $handler->display->display_options['arguments']['aid']['summary']['format'] = 'default_summary';
  $handler->display->display_options['arguments']['aid']['summary_options']['items_per_page'] = '25';
  $handler->display->display_options['arguments']['aid']['specify_validation'] = TRUE;
  $handler->display->display_options['arguments']['aid']['validate']['type'] = 'uc_addresses_address_access';
  $handler->display->display_options['arguments']['aid']['validate_options']['access_type'] = 'edit';
  $handler->display->display_options['arguments']['aid']['validate']['fail'] = 'access denied';
  $handler->display->display_options['path'] = 'user/%/uc_addresses_argument_validator_edit';
  $handler->display->display_options['menu']['type'] = 'tab';
  $handler->display->display_options['menu']['title'] = 'AddressBookEdit';
  $handler->display->display_options['menu']['weight'] = '0';
  $handler->display->display_options['menu']['context'] = 0;

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

  /* Contextual filter: Ubercart Addresses: User ID */
  $handler->display->display_options['arguments']['uid']['id'] = 'uid';
  $handler->display->display_options['arguments']['uid']['table'] = 'uc_addresses';
  $handler->display->display_options['arguments']['uid']['field'] = 'uid';
  $handler->display->display_options['arguments']['uid']['default_action'] = 'not found';
  $handler->display->display_options['arguments']['uid']['default_argument_type'] = 'fixed';
  $handler->display->display_options['arguments']['uid']['summary']['number_of_records'] = '0';
  $handler->display->display_options['arguments']['uid']['summary']['format'] = 'default_summary';
  $handler->display->display_options['arguments']['uid']['summary_options']['items_per_page'] = '25';
  $handler->display->display_options['arguments']['uid']['specify_validation'] = TRUE;
  $handler->display->display_options['arguments']['uid']['validate']['type'] = 'uc_addresses_user_address_access';
  $handler->display->display_options['arguments']['uid']['validate_options']['access_type'] = 'delete';
  $handler->display->display_options['arguments']['uid']['validate']['fail'] = 'access denied';

  /* Contextual filter: Ubercart Addresses: Address ID */
  $handler->display->display_options['arguments']['aid']['id'] = 'aid';
  $handler->display->display_options['arguments']['aid']['table'] = 'uc_addresses';
  $handler->display->display_options['arguments']['aid']['field'] = 'aid';
  $handler->display->display_options['arguments']['aid']['default_argument_type'] = 'fixed';
  $handler->display->display_options['arguments']['aid']['summary']['number_of_records'] = '0';
  $handler->display->display_options['arguments']['aid']['summary']['format'] = 'default_summary';
  $handler->display->display_options['arguments']['aid']['summary_options']['items_per_page'] = '25';
  $handler->display->display_options['arguments']['aid']['specify_validation'] = TRUE;
  $handler->display->display_options['arguments']['aid']['validate']['type'] = 'uc_addresses_address_access';
  $handler->display->display_options['arguments']['aid']['validate_options']['access_type'] = 'delete';
  $handler->display->display_options['arguments']['aid']['validate']['fail'] = 'access denied';
  $handler->display->display_options['path'] = 'user/%/uc_addresses_argument_validator_delete';
  $handler->display->display_options['menu']['type'] = 'tab';
  $handler->display->display_options['menu']['title'] = 'AddressBookDelete';
  $handler->display->display_options['menu']['weight'] = '0';
  $handler->display->display_options['menu']['context'] = 0;

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