summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2013-10-13 12:41:50 (GMT)
committerNathaniel Catchpole2013-10-13 12:41:50 (GMT)
commitc63dd2094926da7548cf4561cd948e00781bdb51 (patch)
treea4a7d05c322a7f2b772ff78a2c608137b031633a
parentaa05c211a71a241bc3e60c7873267fb65851055d (diff)
Issue #1987856 by mparker17, vijaycs85, sidharthap, disasm, ianmthomasuk: Convert system_timezone() to a new style controller.
-rw-r--r--core/modules/system/lib/Drupal/system/Tests/Datetime/DrupalDateTimeTest.php14
-rw-r--r--core/modules/system/system.routing.yml5
2 files changed, 18 insertions, 1 deletions
diff --git a/core/modules/system/lib/Drupal/system/Tests/Datetime/DrupalDateTimeTest.php b/core/modules/system/lib/Drupal/system/Tests/Datetime/DrupalDateTimeTest.php
index 9673c9c..3707bf8 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Datetime/DrupalDateTimeTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Datetime/DrupalDateTimeTest.php
@@ -37,6 +37,20 @@ class DrupalDateTimeTest extends WebTestBase {
}
/**
+ * Test that the AJAX Timezone Callback can deal with various formats.
+ */
+ public function testSystemTimezone() {
+ $options = array(
+ 'query' => array(
+ 'date' => 'Tue+Sep+17+2013+21%3A35%3A31+GMT%2B0100+(BST)#',
+ )
+ );
+ // Query the AJAX Timezone Callback with a long-format date.
+ $response = $this->drupalGet('system/timezone/BST/3600/1', $options);
+ $this->assertEqual($response, '"Europe\/London"', 'Timezone AJAX callback successfully identifies and responds to a long-format date.');
+ }
+
+ /**
* Test that DrupalDateTime can detect the right timezone to use.
* Test with a variety of less commonly used timezone names to
* help ensure that the system timezone will be different than the
diff --git a/core/modules/system/system.routing.yml b/core/modules/system/system.routing.yml
index d759cf3..4d1c90ac 100644
--- a/core/modules/system/system.routing.yml
+++ b/core/modules/system/system.routing.yml
@@ -344,9 +344,12 @@ system.modules_uninstall_confirm:
_permission: 'administer modules'
system.timezone:
- path: '/system/timezone'
+ path: '/system/timezone/{abbreviation}/{offset}/{is_daylight_saving_time}'
defaults:
_controller: '\Drupal\system\Controller\TimezoneController::getTimezone'
+ abbreviation: ''
+ offset: -1
+ is_daylight_saving_time: NULL
requirements:
_access: 'TRUE'