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