diff --git a/app/Config/routes.php b/app/Config/routes.php
index b3823779e..32151d27c 100644
--- a/app/Config/routes.php
+++ b/app/Config/routes.php
@@ -38,7 +38,7 @@
CakePlugin::routes();
/**
- * Load the CakePHP default routes. Remove this if you do not want to use
+ * Load the CakePHP default routes. Only remove this if you do not want to use
* the built-in default routes.
*/
require CAKE . 'Config' . DS . 'routes.php';
diff --git a/lib/Cake/Console/Templates/skel/Config/routes.php b/lib/Cake/Console/Templates/skel/Config/routes.php
index 82cd2dbe9..c68cc3e4a 100644
--- a/lib/Cake/Console/Templates/skel/Config/routes.php
+++ b/lib/Cake/Console/Templates/skel/Config/routes.php
@@ -38,7 +38,7 @@
CakePlugin::routes();
/**
- * Load the CakePHP default routes. Remove this if you do not want to use
+ * Load the CakePHP default routes. Only remove this if you do not want to use
* the built-in default routes.
*/
require CAKE . 'Config' . DS . 'routes.php';
diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php
index 22a7cb5c0..f31e78883 100644
--- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php
@@ -2247,6 +2247,43 @@ class FormHelperTest extends CakeTestCase {
$this->assertRegExp('##', $result);
}
+/**
+ * Test interval + selected near the hour roll over.
+ *
+ * @return void
+ */
+ public function testTimeSelectedWithInterval() {
+ $result = $this->Form->input('Model.start_time', array(
+ 'timeFormat' => 24,
+ 'type' => 'time',
+ 'interval' => 15,
+ 'selected' => '15:57'
+ ));
+ $this->assertContains('', $result);
+ $this->assertContains('', $result);
+
+ $result = $this->Form->input('Model.start_time', array(
+ 'timeFormat' => 24,
+ 'type' => 'time',
+ 'interval' => 15,
+ 'selected' => '23:57'
+ ));
+ $this->assertContains('', $result);
+ $this->assertContains('', $result);
+
+ $result = $this->Form->input('Model.created', array(
+ 'timeFormat' => 24,
+ 'type' => 'datetime',
+ 'interval' => 15,
+ 'selected' => '2012-09-30 23:56'
+ ));
+ $this->assertContains('', $result);
+ $this->assertContains('', $result);
+ $this->assertContains('', $result);
+ $this->assertContains('', $result);
+ $this->assertContains('', $result);
+ }
+
/**
* test form->input() with datetime, date and time types
*
diff --git a/lib/Cake/Test/Case/View/ViewTest.php b/lib/Cake/Test/Case/View/ViewTest.php
index 303389158..cc8713dcd 100644
--- a/lib/Cake/Test/Case/View/ViewTest.php
+++ b/lib/Cake/Test/Case/View/ViewTest.php
@@ -21,6 +21,7 @@ App::uses('View', 'View');
App::uses('Helper', 'View');
App::uses('Controller', 'Controller');
App::uses('CacheHelper', 'View/Helper');
+App::uses('HtmlHelper', 'View/Helper');
App::uses('ErrorHandler', 'Error');
@@ -1421,6 +1422,22 @@ TEXT;
$this->View->render('extend_missing_element');
}
+/**
+ * Test extend() preceeded by an element()
+ *
+ * @return void
+ */
+ public function testExtendWithElementBeforeExtend() {
+ $this->View->layout = false;
+ $result = $this->View->render('extend_with_element');
+ $expected = <<assertEquals($expected, $result);
+ }
+
/**
* Test that setting arbitrary properties still works.
*
@@ -1485,4 +1502,4 @@ TEXT;
$result = $this->View->fetch('title', $default);
$this->assertEquals($expected, $result);
}
-}
\ No newline at end of file
+}
diff --git a/lib/Cake/Test/test_app/View/Posts/extend_with_element.ctp b/lib/Cake/Test/test_app/View/Posts/extend_with_element.ctp
new file mode 100644
index 000000000..eda18b709
--- /dev/null
+++ b/lib/Cake/Test/test_app/View/Posts/extend_with_element.ctp
@@ -0,0 +1,3 @@
+element('test_element'); ?>
+extend('parent_view'); ?>
+The view
diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php
index 9968fc4e1..bc1246528 100644
--- a/lib/Cake/View/Helper/FormHelper.php
+++ b/lib/Cake/View/Helper/FormHelper.php
@@ -2261,6 +2261,20 @@ class FormHelper extends AppHelper {
$monthNames = $attributes['monthNames'];
$attributes = array_diff_key($attributes, $defaults);
+ if (!empty($interval) && $interval > 1 && !empty($min)) {
+ $current = new DateTime();
+ if ($year !== null) {
+ $current->setDate($year, $month, $day);
+ }
+ if ($hour !== null) {
+ $current->setTime($hour, $min);
+ }
+ $change = (round($min * (1 / $interval)) * $interval) - $min;
+ $current->modify($change > 0 ? "+$change minutes" : "$change minutes");
+ $newTime = explode(' ', $current->format('Y m d H i a'));
+ list($year, $month, $day, $hour, $min, $meridian) = $newTime;
+ }
+
if (isset($attributes['id'])) {
if (is_string($attributes['id'])) {
// build out an array version
@@ -2322,9 +2336,6 @@ class FormHelper extends AppHelper {
}
$opt = implode($separator, $selects);
- if (!empty($interval) && $interval > 1 && !empty($min)) {
- $min = round($min * (1 / $interval)) * $interval;
- }
$selectMinuteAttr['interval'] = $interval;
switch ($timeFormat) {
case '24':
diff --git a/lib/Cake/View/View.php b/lib/Cake/View/View.php
index 51d486128..1d608e10b 100644
--- a/lib/Cake/View/View.php
+++ b/lib/Cake/View/View.php
@@ -891,7 +891,7 @@ class View extends Object {
* Sandbox method to evaluate a template / view script in.
*
* @param string $viewFn Filename of the view
- * @param array $___dataForView Data to include in rendered view.
+ * @param array $dataForView Data to include in rendered view.
* If empty the current View::$viewVars will be used.
* @return string Rendered output
*/
@@ -1156,9 +1156,15 @@ class View extends Object {
$this->getEventManager()->dispatch(new CakeEvent('View.beforeRender', $this, array($file)));
}
+ $current = $this->_current;
+ $restore = $this->_currentType;
+
$this->_currentType = self::TYPE_ELEMENT;
$element = $this->_render($file, array_merge($this->viewVars, $data));
+ $this->_currentType = $restore;
+ $this->_current = $current;
+
if (isset($options['callbacks'])) {
$this->getEventManager()->dispatch(new CakeEvent('View.afterRender', $this, array($file, $element)));
}