1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Tests date popup in Views
|
6
|
*/
|
7
|
|
8
|
class DateViewsPopupTestCase extends DateFieldBasic {
|
9
|
/**
|
10
|
* Test info.
|
11
|
*/
|
12
|
public static function getInfo() {
|
13
|
return array(
|
14
|
'name' => 'Date Views - Popup Test',
|
15
|
'description' => 'Tests date popup in Views',
|
16
|
'group' => 'Date',
|
17
|
);
|
18
|
}
|
19
|
|
20
|
/**
|
21
|
* Test setup actions.
|
22
|
*/
|
23
|
public function setUp() {
|
24
|
parent::setUp();
|
25
|
// Load the 'date_popup', 'date_views', 'views', 'views_ui', 'ctools' modules.
|
26
|
$modules = array('date_popup', 'date_views', 'views', 'views_ui', 'ctools');
|
27
|
$success = module_enable($modules, TRUE);
|
28
|
$this->assertTrue($success, t('Enabled modules: %modules', array('%modules' => implode(', ', $modules))));
|
29
|
|
30
|
// Reset/rebuild all data structures after enabling the modules.
|
31
|
$this->resetAll();
|
32
|
|
33
|
// Create a date field.
|
34
|
$field_name = "field_test_date_popup";
|
35
|
$label = 'Test';
|
36
|
$options = array(
|
37
|
'label' => 'Test',
|
38
|
'widget_type' => 'date_popup',
|
39
|
'field_name' => $field_name,
|
40
|
'field_type' => 'datetime',
|
41
|
'input_format' => 'm/d/Y - H:i',
|
42
|
);
|
43
|
$this->createDateField($options);
|
44
|
|
45
|
// Set required permissions.
|
46
|
$permissions = array('administer views', 'administer site configuration');
|
47
|
// Create admin user and login.
|
48
|
$admin_user = $this->drupalCreateUser($permissions);
|
49
|
$this->drupalLogin($admin_user);
|
50
|
|
51
|
// Create the view.
|
52
|
$view = new view();
|
53
|
$view->name = 'test_date_popup';
|
54
|
$view->description = '';
|
55
|
$view->tag = 'default';
|
56
|
$view->base_table = 'node';
|
57
|
$view->human_name = 'Test date_popup';
|
58
|
$view->core = 7;
|
59
|
$view->api_version = '3.0';
|
60
|
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
|
61
|
|
62
|
/* Display: Master */
|
63
|
$handler = $view->new_display('default', 'Master', 'default');
|
64
|
$handler->display->display_options['title'] = 'test_date_popup_page';
|
65
|
$handler->display->display_options['use_more_always'] = FALSE;
|
66
|
$handler->display->display_options['access']['type'] = 'perm';
|
67
|
$handler->display->display_options['cache']['type'] = 'none';
|
68
|
$handler->display->display_options['query']['type'] = 'views_query';
|
69
|
$handler->display->display_options['exposed_form']['type'] = 'basic';
|
70
|
$handler->display->display_options['pager']['type'] = 'none';
|
71
|
$handler->display->display_options['pager']['options']['offset'] = '0';
|
72
|
$handler->display->display_options['style_plugin'] = 'default';
|
73
|
$handler->display->display_options['row_plugin'] = 'node';
|
74
|
/* Field: Content: Title */
|
75
|
$handler->display->display_options['fields']['title']['id'] = 'title';
|
76
|
$handler->display->display_options['fields']['title']['table'] = 'node';
|
77
|
$handler->display->display_options['fields']['title']['field'] = 'title';
|
78
|
$handler->display->display_options['fields']['title']['label'] = '';
|
79
|
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
80
|
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
81
|
/* Filter criterion: Content: test_date_popup (field_test_date_popup) */
|
82
|
$handler->display->display_options['filters']['field_test_date_popup_value']['id'] = 'field_test_date_popup_value';
|
83
|
$handler->display->display_options['filters']['field_test_date_popup_value']['table'] = 'field_data_field_test_date_popup';
|
84
|
$handler->display->display_options['filters']['field_test_date_popup_value']['field'] = 'field_test_date_popup_value';
|
85
|
$handler->display->display_options['filters']['field_test_date_popup_value']['exposed'] = TRUE;
|
86
|
$handler->display->display_options['filters']['field_test_date_popup_value']['expose']['operator_id'] = 'field_test_date_popup_value_op';
|
87
|
$handler->display->display_options['filters']['field_test_date_popup_value']['expose']['label'] = 'test_date_popup (field_test_date_popup)';
|
88
|
$handler->display->display_options['filters']['field_test_date_popup_value']['expose']['operator'] = 'field_test_date_popup_value_op';
|
89
|
$handler->display->display_options['filters']['field_test_date_popup_value']['expose']['identifier'] = 'field_test_date_popup_value';
|
90
|
$handler->display->display_options['filters']['field_test_date_popup_value']['form_type'] = 'date_popup';
|
91
|
|
92
|
/* Display: Page */
|
93
|
$handler = $view->new_display('page', 'Page', 'page');
|
94
|
$handler->display->display_options['path'] = 'test-date-popup';
|
95
|
|
96
|
$view->save();
|
97
|
}
|
98
|
|
99
|
/**
|
100
|
* Test date popup.
|
101
|
*/
|
102
|
public function testDatePopup() {
|
103
|
// Go to view page.
|
104
|
$this->drupalGet('test-date-popup');
|
105
|
}
|
106
|
}
|