1 |
599a39cd
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Test the custom field functionality provided by the Date Popup module.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
/**
|
9 |
|
|
* Test the custom field functionality provided by the Date Popup module.
|
10 |
|
|
*/
|
11 |
|
|
class DatePopupFieldTestCase extends DateFieldTestBase {
|
12 |
|
|
|
13 |
|
|
/**
|
14 |
|
|
* Define this test class.
|
15 |
|
|
*/
|
16 |
|
|
public static function getInfo() {
|
17 |
|
|
return array(
|
18 |
|
|
'name' => t('Date Popup'),
|
19 |
|
|
'description' => t('Test the custom functionality of the Date Popup module.'),
|
20 |
|
|
'group' => t('Date'),
|
21 |
|
|
);
|
22 |
|
|
}
|
23 |
|
|
|
24 |
|
|
/**
|
25 |
|
|
* {@inheritdoc}
|
26 |
|
|
*/
|
27 |
|
|
public function setUp(array $modules = array()) {
|
28 |
|
|
$modules[] = 'date_popup';
|
29 |
|
|
parent::setUp($modules);
|
30 |
|
|
|
31 |
|
|
// Don't load the time picker.
|
32 |
|
|
// @todo Add test coverage for the time picker.
|
33 |
|
|
variable_set('date_popup_timepicker', 'none');
|
34 |
|
|
}
|
35 |
|
|
|
36 |
|
|
/**
|
37 |
|
|
* Test the field settings.
|
38 |
|
|
*/
|
39 |
|
|
public function testField() {
|
40 |
|
|
// Test all base field types.
|
41 |
|
|
foreach (array('date', 'datestamp', 'datetime') as $field_type) {
|
42 |
|
|
// Add a Date Popup field to the 'story' content type, but don't remove
|
43 |
|
|
// it.
|
44 |
|
|
$this->checkDateField($field_type, 'date_popup', FALSE);
|
45 |
|
|
|
46 |
|
|
// Load the node form.
|
47 |
|
|
$this->drupalGet('node/add/story');
|
48 |
|
|
$this->assertResponse(200);
|
49 |
|
|
|
50 |
|
|
// Confirm the date field is present.
|
51 |
|
|
$this->assertFieldByName('field_test_date_popup[und][0][value][date]');
|
52 |
|
|
$this->assertFieldByName('field_test_date_popup[und][0][value][time]');
|
53 |
|
|
|
54 |
|
|
// Confirm the JS and CSS files were requested.
|
55 |
|
|
$this->assertRaw('date/date_popup/jquery.timeentry.pack.js');
|
56 |
|
|
$this->assertRaw('date/date_popup/themes/datepicker.1.7.css');
|
57 |
|
|
$this->assertRaw('date/date_popup/themes/jquery.timeentry.css');
|
58 |
|
|
|
59 |
|
|
// Now delete the field.
|
60 |
|
|
$this->deleteDateField('Test');
|
61 |
|
|
}
|
62 |
|
|
}
|
63 |
|
|
|
64 |
|
|
} |