updated ctools, panels, date, diff
This commit is contained in:
@@ -393,7 +393,7 @@ class DateAPITestCase extends DrupalWebTestCase {
|
||||
$input = '23 abc 2012';
|
||||
$timezone = NULL;
|
||||
$format = 'd M Y';
|
||||
$date = new dateObject($input, $timezone, $format);
|
||||
$date = @new dateObject($input, $timezone, $format);
|
||||
$this->assertNotEqual(count($date->errors), 0, '23 abc 2012 should be an invalid date');
|
||||
|
||||
// Test Granularity.
|
||||
|
@@ -16,7 +16,7 @@ abstract class DateFieldBasic extends DrupalWebTestCase {
|
||||
|
||||
// Create and log in our privileged user.
|
||||
$this->privileged_user = $this->drupalCreateUser(
|
||||
array('administer content types', 'administer nodes', 'bypass node access', 'administer date tools')
|
||||
array('administer content types', 'administer nodes', 'bypass node access', 'administer date tools', 'administer fields')
|
||||
);
|
||||
$this->drupalLogin($this->privileged_user);
|
||||
|
||||
|
30
sites/all/modules/contrib/fields/date/tests/date_form.test
Normal file
30
sites/all/modules/contrib/fields/date/tests/date_form.test
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains form specific date element test cases.
|
||||
*/
|
||||
|
||||
class DateFormTestCase extends DrupalWebTestCase {
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => t('Date Form test'),
|
||||
'description' => t('Test Date form functions.') ,
|
||||
'group' => t('Date'),
|
||||
);
|
||||
}
|
||||
|
||||
public function setUp() {
|
||||
// Load the date_api module.
|
||||
parent::setUp('date_test');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests rendering of a date element in a form.
|
||||
*/
|
||||
public function testDateForm() {
|
||||
$this->drupalGet('date-test/form');
|
||||
}
|
||||
|
||||
}
|
@@ -18,6 +18,7 @@ class DateMigrateExampleUnitTest extends DrupalWebTestCase {
|
||||
'name' => 'Date Migration',
|
||||
'description' => 'Test migration into date fields',
|
||||
'group' => 'Date',
|
||||
'dependencies' => array('migrate', 'features'),
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,14 @@
|
||||
name = "Date module tests"
|
||||
description = "Support module for date related testing."
|
||||
package = Date/Time
|
||||
version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
dependencies[] = date
|
||||
|
||||
; Information added by Drupal.org packaging script on 2017-04-07
|
||||
version = "7.x-2.10"
|
||||
core = "7.x"
|
||||
project = "date"
|
||||
datestamp = "1491562090"
|
||||
|
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains date test implementations.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
function date_test_menu() {
|
||||
$items['date-test/form'] = array(
|
||||
'title' => 'Test form with date element',
|
||||
'description' => "Form with date element to make form related tests",
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('date_test_sample_form'),
|
||||
'access arguments' => array('access content'),
|
||||
'type' => MENU_CALLBACK,
|
||||
);
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Form callback. Generates a test form with date elements.
|
||||
*/
|
||||
function date_test_sample_form($form, &$form_state) {
|
||||
$form['date_test_select'] = array(
|
||||
'#type' => 'date_select',
|
||||
'#title' => t('Sample from'),
|
||||
'#date_format' => 'H:i:s a',
|
||||
'#default_value' => array(
|
||||
'hour' => 7,
|
||||
'minute' => 0,
|
||||
'second' => 0,
|
||||
'ampm' => 'am'
|
||||
),
|
||||
);
|
||||
|
||||
return $form;
|
||||
}
|
@@ -16,6 +16,16 @@ class DateTimezoneTestCase extends DateFieldBasic {
|
||||
);
|
||||
}
|
||||
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
// Set the timezone explicitly. Otherwise the site's default timezone is
|
||||
// used, which defaults to the server timezone when installing Drupal. This
|
||||
// depends on the environment and is therefore uncertain.
|
||||
// The Australia/Sydney timezone is chosen so all tests are run using an
|
||||
// edge case scenario (UTC+10 and DST).
|
||||
variable_set('date_default_timezone', 'Australia/Sydney');
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo.
|
||||
*/
|
||||
@@ -23,7 +33,7 @@ class DateTimezoneTestCase extends DateFieldBasic {
|
||||
// Create a date fields with combinations of various timezone handling and
|
||||
// granularity.
|
||||
foreach (array('date', 'datestamp', 'datetime') as $field_type) {
|
||||
foreach (array('site', 'none', 'date', 'user', 'utc') as $tz_handling) {
|
||||
foreach (array('site', 'none', 'date', 'user', 'utc', 'Europe/Dublin') as $tz_handling) {
|
||||
foreach (array('year', 'month', 'day', 'hour', 'minute', 'second') as $max_granularity) {
|
||||
// Skip invalid combinations.
|
||||
if (in_array($max_granularity, array('year', 'month', 'day')) && $tz_handling != 'none') {
|
||||
@@ -182,17 +192,32 @@ class DateTimezoneTestCase extends DateFieldBasic {
|
||||
case 'hour':
|
||||
$edit[$field_name . '[und][0][value][date]'] = '10/07/2010 - 10';
|
||||
$edit[$field_name . '[und][0][value2][date]'] = '10/07/2010 - 11';
|
||||
$should_be = 'Thu, 10/07/2010 - 10 to Thu, 10/07/2010 - 11';
|
||||
if ($tz_handling == 'utc') {
|
||||
$should_be = 'Thu, 10/07/2010 - 21 to Thu, 10/07/2010 - 22';
|
||||
}
|
||||
else {
|
||||
$should_be = 'Thu, 10/07/2010 - 10 to Thu, 10/07/2010 - 11';
|
||||
}
|
||||
break;
|
||||
case 'minute':
|
||||
$edit[$field_name . '[und][0][value][date]'] = '10/07/2010 - 10:30';
|
||||
$edit[$field_name . '[und][0][value2][date]'] = '10/07/2010 - 11:30';
|
||||
$should_be = 'Thu, 10/07/2010 - 10:30 to 11:30';
|
||||
if ($tz_handling == 'utc') {
|
||||
$should_be = 'Thu, 10/07/2010 - 21:30 to 22:30';
|
||||
}
|
||||
else {
|
||||
$should_be = 'Thu, 10/07/2010 - 10:30 to 11:30';
|
||||
}
|
||||
break;
|
||||
case 'second':
|
||||
$edit[$field_name . '[und][0][value][date]'] = '10/07/2010 - 10:30:30';
|
||||
$edit[$field_name . '[und][0][value2][date]'] = '10/07/2010 - 11:30:30';
|
||||
$should_be = 'Thu, 10/07/2010 - 10:30:30 to 11:30:30';
|
||||
if ($tz_handling == 'utc') {
|
||||
$should_be = 'Thu, 10/07/2010 - 21:30:30 to 22:30:30';
|
||||
}
|
||||
else {
|
||||
$should_be = 'Thu, 10/07/2010 - 10:30:30 to 11:30:30';
|
||||
}
|
||||
break;
|
||||
}
|
||||
$this->drupalPost('node/add/story', $edit, t('Save'));
|
||||
|
Reference in New Issue
Block a user