DateViewsPopupTestCase.test in Date 7.2
Same filename and directory in other branches
Tests Date Popup in the Views interface.
File
date_popup/tests/DateViewsPopupTestCase.testView source
<?php
/**
* @file
* Tests Date Popup in the Views interface.
*/
/**
* Tests Date Popup in the Views interface.
*/
class DatePopupWithViewsTestCase extends DateFieldTestBase {
/**
* Test info.
*/
public static function getInfo() {
return array(
'name' => 'Date Views - Popup Test',
'description' => 'Tests date popup in Views',
'group' => 'Date',
'dependencies' => array(
'ctools',
'views',
),
);
}
/**
* {@inheritdoc}
*/
public function setUp(array $modules = array()) {
$modules[] = 'date_popup';
$modules[] = 'date_views';
$modules[] = 'ctools';
$modules[] = 'views';
$modules[] = 'views_ui';
parent::setUp($modules);
// Reset/rebuild all data structures after enabling the modules.
$this
->resetAll();
// Create a date field.
$field_name = "field_test_date_popup";
$label = 'Test';
$options = array(
'label' => 'Test',
'widget_type' => 'date_popup',
'field_name' => $field_name,
'field_type' => 'datetime',
'input_format' => 'm/d/Y - H:i',
);
$this
->createDateField($options);
// Set required permissions.
$permissions = array(
'administer views',
'administer site configuration',
);
// Create admin user and login.
$admin_user = $this
->drupalCreateUser($permissions);
$this
->drupalLogin($admin_user);
// Create the view.
$view = new view();
$view->name = 'test_date_popup';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Test date_popup';
$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['title'] = 'test_date_popup_page';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$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'] = 'node';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
/* Filter criterion: Content: test_date_popup (field_test_date_popup) */
$handler->display->display_options['filters']['field_test_date_popup_value']['id'] = 'field_test_date_popup_value';
$handler->display->display_options['filters']['field_test_date_popup_value']['table'] = 'field_data_field_test_date_popup';
$handler->display->display_options['filters']['field_test_date_popup_value']['field'] = 'field_test_date_popup_value';
$handler->display->display_options['filters']['field_test_date_popup_value']['exposed'] = TRUE;
$handler->display->display_options['filters']['field_test_date_popup_value']['expose']['operator_id'] = 'field_test_date_popup_value_op';
$handler->display->display_options['filters']['field_test_date_popup_value']['expose']['label'] = 'test_date_popup (field_test_date_popup)';
$handler->display->display_options['filters']['field_test_date_popup_value']['expose']['operator'] = 'field_test_date_popup_value_op';
$handler->display->display_options['filters']['field_test_date_popup_value']['expose']['identifier'] = 'field_test_date_popup_value';
$handler->display->display_options['filters']['field_test_date_popup_value']['form_type'] = 'date_popup';
/* Display: Page */
$handler = $view
->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'test-date-popup';
$view
->save();
}
/**
* Test date popup.
*/
public function testDatePopup() {
// Go to view page.
$this
->drupalGet('test-date-popup');
}
}
Classes
Name | Description |
---|---|
DatePopupWithViewsTestCase | Tests Date Popup in the Views interface. |