protected function UcAddressesViewsTestCase::createDisplayAccessView in Ubercart Addresses 7
Same name and namespace in other branches
- 6.2 tests/uc_addresses.views.test \UcAddressesViewsTestCase::createDisplayAccessView()
Creates a View for Display access test.
Return value
object The created View.
1 call to UcAddressesViewsTestCase::createDisplayAccessView()
- UcAddressesViewsTestCase::testDisplayAccessPlugin in tests/
uc_addresses.views.test - Tests if the display access plugin works as expected.
File
- tests/
uc_addresses.views.test, line 655 - Test cases for Views integration.
Class
- UcAddressesViewsTestCase
- Test cases for Views integration.
Code
protected function createDisplayAccessView() {
$view = new view();
$view->name = 'uc_addresses_display_access';
$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_display_access';
$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';
/* 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'] = 'user';
/* 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';
/* 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']['access'] = FALSE;
$handler->display->display_options['access']['type'] = 'uc_addresses_views_access';
$handler->display->display_options['access']['uid_argument'] = 'uid';
$handler->display->display_options['access']['aid_argument'] = 'aid';
$handler->display->display_options['path'] = 'user/%/uc_addresses_display_access_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']['access'] = FALSE;
$handler->display->display_options['access']['type'] = 'uc_addresses_views_access';
$handler->display->display_options['access']['uid_argument'] = 'uid';
$handler->display->display_options['access']['aid_argument'] = 'aid';
$handler->display->display_options['access']['access_type'] = 'edit';
$handler->display->display_options['path'] = 'user/%/uc_addresses_display_access_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']['access'] = FALSE;
$handler->display->display_options['access']['type'] = 'uc_addresses_views_access';
$handler->display->display_options['access']['uid_argument'] = 'uid';
$handler->display->display_options['access']['aid_argument'] = 'aid';
$handler->display->display_options['access']['access_type'] = 'delete';
$handler->display->display_options['path'] = 'user/%/uc_addresses_display_access_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;
}