Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make methods protected.

Make all the methods protected. This will make changing things later
easier as there is only one public method.

Remove tests for the internals as they are no longer needed.
  • Loading branch information...
commit b1c0b87814a7e9122335ba3dd04b7b3586a965ec 1 parent 8e874ab
@markstory markstory authored
View
16 src/View/Input/DateTime.php
@@ -146,7 +146,7 @@ public function render(array $data) {
$select
));
}
- $method = $select . 'Select';
+ $method = "_{$select}Select";
$data[$select]['name'] = $data['name'] . "[" . $select . "]";
$data[$select]['val'] = $selected[$select];
@@ -239,7 +239,7 @@ protected function _adjustValue($value, $options) {
* @param array $options
* @return string
*/
- public function yearSelect($options = []) {
+ protected function _yearSelect($options = []) {
$options += [
'name' => '',
'val' => null,
@@ -268,7 +268,7 @@ public function yearSelect($options = []) {
* @param array $options
* @return string
*/
- public function monthSelect($options = []) {
+ protected function _monthSelect($options = []) {
$options += [
'name' => '',
'names' => false,
@@ -295,7 +295,7 @@ public function monthSelect($options = []) {
* @param array $options
* @return string
*/
- public function daySelect($options = []) {
+ protected function _daySelect($options = []) {
$options += [
'name' => '',
'val' => null,
@@ -314,7 +314,7 @@ public function daySelect($options = []) {
* @param array $options
* @return string
*/
- public function hourSelect($options = []) {
+ protected function _hourSelect($options = []) {
$options += [
'name' => '',
'val' => null,
@@ -343,7 +343,7 @@ public function hourSelect($options = []) {
* @param array $options
* @return string
*/
- public function minuteSelect($options = []) {
+ protected function _minuteSelect($options = []) {
$options += [
'name' => '',
'val' => null,
@@ -371,7 +371,7 @@ public function minuteSelect($options = []) {
* @param array $options
* @return string
*/
- public function secondSelect($options = []) {
+ protected function _secondSelect($options = []) {
$options += [
'name' => '',
'val' => null,
@@ -390,7 +390,7 @@ public function secondSelect($options = []) {
* @param array $options
* @return string
*/
- public function meridianSelect($options = []) {
+ protected function _meridianSelect($options = []) {
$options += [
'name' => '',
'val' => null,
View
57 tests/TestCase/View/Input/DateTimeTest.php
@@ -15,17 +15,10 @@
namespace Cake\Test\TestCase\View\Input;
use Cake\TestSuite\TestCase;
+use Cake\View\Input\DateTime;
use Cake\View\Input\SelectBox;
use Cake\View\StringTemplate;
-class DateTime extends \Cake\View\Input\DateTime {
-
- public function generateNumbers($start = 1, $end = 31, $options = []) {
- return parent::_generateNumbers($start, $end, $options);
- }
-
-}
-
/**
* DateTime input test case
*/
@@ -725,52 +718,4 @@ public function testRenderMeridianWidget() {
$this->assertTags($result, $expected);
}
-/**
- * testGenerateNumbers
- *
- * @return void
- */
- public function testGenerateNumbers() {
- $result = $this->DateTime->generateNumbers(1, 3);
- $expected = array(
- '01' => '01',
- '02' => '02',
- '03' => '03'
- );
- $this->assertEquals($result, $expected);
-
- $result = $this->DateTime->generateNumbers(1, 3, [
- 'leadingZeroKey' => false
- ]);
- $expected = array(
- 1 => '01',
- 2 => '02',
- 3 => '03'
- );
- $this->assertEquals($result, $expected);
-
- $result = $this->DateTime->generateNumbers(1, 5, [
- 'leadingZeroValue' => false
- ]);
- $expected = array(
- '01' => '1',
- '02' => '2',
- '03' => '3',
- '04' => '4',
- '05' => '5'
- );
- $this->assertEquals($result, $expected);
-
- $result = $this->DateTime->generateNumbers(1, 3, [
- 'leadingZeroValue' => false,
- 'leadingZeroKey' => false
- ]);
- $expected = array(
- 1 => '1',
- 2 => '2',
- 3 => '3'
- );
- $this->assertEquals($result, $expected);
- }
-
}
Please sign in to comment.
Something went wrong with that request. Please try again.