From d816ea6e1603f10c7878c4bb2af74daf4c9a78eb Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 30 Jun 2016 23:08:43 -0400 Subject: [PATCH 1/2] Add test showing that niceShort translates month names. Refs #8968 --- lib/Cake/Test/Case/Utility/CakeTimeTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/Cake/Test/Case/Utility/CakeTimeTest.php b/lib/Cake/Test/Case/Utility/CakeTimeTest.php index 2620f7897..f5741272f 100644 --- a/lib/Cake/Test/Case/Utility/CakeTimeTest.php +++ b/lib/Cake/Test/Case/Utility/CakeTimeTest.php @@ -454,6 +454,17 @@ class CakeTimeTest extends CakeTestCase { $this->_restoreSystemTimezone(); } +/** + * testNiceShort translations + * + * @return void + */ + public function testNiceShortI18n() { + setlocale(LC_ALL, 'es_ES'); + $time = strtotime('2015-01-07 03:05:00'); + $this->assertEquals('ene 7th 2015, 03:05', $this->Time->niceShort($time)); + } + /** * testDaysAsSql method * From 234f732d6dfec0c1ddfc59abb0530a1194241e57 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 1 Jul 2016 17:15:23 -0400 Subject: [PATCH 2/2] Attempt to get tests passing on travis. Also attempt to get stickler to ignore the 2.x branch. --- .travis.yml | 1 + lib/Cake/Test/Case/Utility/CakeTimeTest.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index c3492d555..b43db1d25 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,7 @@ before_script: - sh -c "composer global require 'phpunit/phpunit=3.7.33'" - sh -c "ln -s ~/.composer/vendor/phpunit/phpunit/PHPUnit ./vendors/PHPUnit" - sudo locale-gen de_DE + - sudo locale-gen es_ES - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test;'; fi" - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test2;'; fi" - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test3;'; fi" diff --git a/lib/Cake/Test/Case/Utility/CakeTimeTest.php b/lib/Cake/Test/Case/Utility/CakeTimeTest.php index f5741272f..dc2a8887c 100644 --- a/lib/Cake/Test/Case/Utility/CakeTimeTest.php +++ b/lib/Cake/Test/Case/Utility/CakeTimeTest.php @@ -460,9 +460,11 @@ class CakeTimeTest extends CakeTestCase { * @return void */ public function testNiceShortI18n() { + $restore = setlocale(LC_ALL, 0); setlocale(LC_ALL, 'es_ES'); $time = strtotime('2015-01-07 03:05:00'); $this->assertEquals('ene 7th 2015, 03:05', $this->Time->niceShort($time)); + setlocale(LC_ALL, $restore); } /**