You are here

protected function UcAddressesViewsTestCase::createActionLinksView in Ubercart Addresses 7

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

Creates a View for Action links test.

Return value

object The created View.

1 call to UcAddressesViewsTestCase::createActionLinksView()
UcAddressesViewsTestCase::testActionLinks in tests/uc_addresses.views.test
Tests if the view, edit and delete links are only displayed for users that are allowed to perform these tasks.

File

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

Class

UcAddressesViewsTestCase
Test cases for Views integration.

Code

protected function createActionLinksView() {
  $view = new view();
  $view->name = 'uc_addresses_action_links';
  $view->description = 'Used to test if address action links work as expected.';
  $view->tag = 'default';
  $view->base_table = 'uc_addresses';
  $view->human_name = 'uc_addresses_action_links';
  $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';

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

  /* Field: Ubercart Addresses: Edit link */
  $handler->display->display_options['fields']['edit']['id'] = 'edit';
  $handler->display->display_options['fields']['edit']['table'] = 'uc_addresses';
  $handler->display->display_options['fields']['edit']['field'] = 'edit';

  /* Field: Ubercart Addresses: Delete link */
  $handler->display->display_options['fields']['delete']['id'] = 'delete';
  $handler->display->display_options['fields']['delete']['table'] = 'uc_addresses';
  $handler->display->display_options['fields']['delete']['field'] = 'delete';

  /* Display: Page */
  $handler = $view
    ->new_display('page', 'Page', 'page_1');
  $handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
  $handler->display->display_options['path'] = 'uc_addresses/action-links';

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