Browse Source

Merge branch 'master' into 3.next

Mark Story 7 years ago
parent
commit
fb88916566

+ 2 - 2
src/Mailer/Email.php

@@ -2432,7 +2432,7 @@ class Email implements JsonSerializable, Serializable
             if (!preg_match('/<[a-z]+.*>/i', $line)) {
                 $formatted = array_merge(
                     $formatted,
-                    explode("\n", wordwrap($line, $wrapLength, "\n", $cut))
+                    explode("\n", Text::wordWrap($line, $wrapLength, "\n", $cut))
                 );
                 continue;
             }
@@ -2453,7 +2453,7 @@ class Email implements JsonSerializable, Serializable
                             if ($tmpLineLength > 0) {
                                 $formatted = array_merge(
                                     $formatted,
-                                    explode("\n", wordwrap(trim($tmpLine), $wrapLength, "\n", $cut))
+                                    explode("\n", Text::wordWrap(trim($tmpLine), $wrapLength, "\n", $cut))
                                 );
                                 $tmpLine = '';
                                 $tmpLineLength = 0;

+ 2 - 2
tests/TestCase/Collection/Iterator/SortIteratorTest.php

@@ -80,7 +80,7 @@ class SortIteratorTest extends TestCase
         $callback = function ($a) {
             return $a['foo'];
         };
-        $sorted = new SortIterator($items, $callback, SORT_DESC, SORT_NUMERIC);
+        $sorted = new SortIterator($items, $callback, \SORT_DESC, \SORT_NUMERIC);
         $expected = [
             ['foo' => 13, 'bar' => 'a'],
             ['foo' => 10, 'bar' => 'a'],
@@ -89,7 +89,7 @@ class SortIteratorTest extends TestCase
         ];
         $this->assertEquals($expected, $sorted->toList());
 
-        $sorted = new SortIterator($items, $callback, SORT_ASC, SORT_NUMERIC);
+        $sorted = new SortIterator($items, $callback, \SORT_ASC, \SORT_NUMERIC);
         $expected = [
             ['foo' => 1, 'bar' => 'a'],
             ['foo' => 2, 'bar' => 'a'],

+ 2 - 3
tests/TestCase/Command/HelpCommandTest.php

@@ -19,9 +19,9 @@ use Cake\Core\Plugin;
 use Cake\TestSuite\ConsoleIntegrationTestCase;
 
 /**
- * HelpShell test.
+ * HelpCommand test.
  */
-class HelpShellTest extends ConsoleIntegrationTestCase
+class HelpCommandTest extends ConsoleIntegrationTestCase
 {
     /**
      * setup method
@@ -63,7 +63,6 @@ class HelpShellTest extends ConsoleIntegrationTestCase
     /**
      * Assert the help output.
      *
-     * @param string $output The output to check.
      * @return void
      */
     protected function assertCommandList()

+ 4 - 4
tests/TestCase/I18n/DateTest.php

@@ -108,16 +108,16 @@ class DateTest extends TestCase
         $class::setDefaultLocale('fr-FR');
         $result = $time->i18nFormat(\IntlDateFormatter::FULL);
         $result = str_replace(' à', '', $result);
-        $expected = 'jeudi 14 janvier 2010 00:00:00 UTC';
-        $this->assertEquals($expected, $result);
+        $expected = 'jeudi 14 janvier 2010 00:00:00';
+        $this->assertStringStartsWith($expected, $result);
 
         $result = $time->i18nFormat(\IntlDateFormatter::FULL, null, 'es-ES');
         $this->assertContains('14 de enero de 2010', $result, 'Default locale should not be used');
 
         $time = new $class('2014-01-01T00:00:00Z');
         $result = $time->i18nFormat(\IntlDateFormatter::FULL, null, 'en-US');
-        $expected = 'Wednesday, January 1, 2014 at 12:00:00 AM GMT';
-        $this->assertEquals($expected, $result);
+        $expected = 'Wednesday, January 1, 2014 at 12:00:00 AM';
+        $this->assertStringStartsWith($expected, $result);
     }
 
     /**

+ 9 - 3
tests/TestCase/I18n/TimeTest.php

@@ -459,15 +459,15 @@ class TimeTest extends TestCase
         $this->assertTimeFormat($expected, $result, 'Default locale should not be used');
 
         $result = $time->i18nFormat(\IntlDateFormatter::FULL, null, 'fa-SA');
-        $expected = 'پنجشنبه ۱۴ ژانویهٔ ۲۰۱۰، ساعت ۱۳:۵۹:۲۸ (GMT)';
+        $expected = 'پنجشنبه ۱۴ ژانویهٔ ۲۰۱۰، ساعت ۱۳:۵۹:۲۸ GMT';
         $this->assertTimeFormat($expected, $result, 'fa-SA locale should be used');
 
         $result = $time->i18nFormat(\IntlDateFormatter::FULL, null, 'en-IR@calendar=persian');
         $expected = 'Thursday, Dey 24, 1388 at 1:59:28 PM GMT';
         $this->assertTimeFormat($expected, $result);
 
-        $result = $time->i18nFormat(\IntlDateFormatter::FULL, null, 'ps-IR@calendar=persian');
-        $expected = 'پنجشنبه د  ۱۳۸۸ د مرغومی ۲۴ ۱۳:۵۹:۲۸ (GMT)';
+        $result = $time->i18nFormat(\IntlDateFormatter::SHORT, null, 'fa-IR@calendar=persian');
+        $expected = '۱۳۸۸/۱۰/۲۴،‏ ۱۳:۵۹:۲۸ GMT';
         $this->assertTimeFormat($expected, $result);
 
         $result = $time->i18nFormat(\IntlDateFormatter::FULL, null, 'en-KW@calendar=islamic');
@@ -917,8 +917,14 @@ class TimeTest extends TestCase
         $expected = str_replace([',', '(', ')', ' at', ' م.', ' ه‍.ش.', ' AP', ' AH', ' SAKA', 'à '], '', $expected);
         $expected = str_replace(['  '], ' ', $expected);
 
+        $result = str_replace('Temps universel coordonné', 'UTC', $result);
+        $result = str_replace('tiempo universal coordinado', 'GMT', $result);
+        $result = str_replace('Coordinated Universal Time', 'GMT', $result);
+
         $result = str_replace([',', '(', ')', ' at', ' م.', ' ه‍.ش.', ' AP', ' AH', ' SAKA', 'à '], '', $result);
         $result = str_replace(['گرینویچ'], 'GMT', $result);
+        $result = str_replace('زمان هماهنگ جهانی', 'GMT', $result);
+        $result = str_replace('همغږۍ نړیواله موده', 'GMT', $result);
         $result = str_replace(['  '], ' ', $result);
 
         $this->assertSame($expected, $result, $message);

+ 4 - 4
tests/TestCase/View/Helper/TimeHelperTest.php

@@ -526,8 +526,8 @@ class TimeHelperTest extends TestCase
         $this->assertTimeFormat($expected, $result);
 
         $result = $this->Time->format($time, \IntlDateFormatter::FULL);
-        $expected = 'Thursday, January 14, 2010 at 1:59:28 PM GMT';
-        $this->assertTimeFormat($expected, $result);
+        $expected = 'Thursday, January 14, 2010 at 1:59:28 PM';
+        $this->assertStringStartsWith($expected, $result);
 
         $result = $this->Time->format('invalid date', null, 'Date invalid');
         $expected = 'Date invalid';
@@ -537,8 +537,8 @@ class TimeHelperTest extends TestCase
         Time::$defaultLocale = 'fr_FR';
         $time = new \Cake\I18n\FrozenTime('Thu Jan 14 13:59:28 2010');
         $result = $this->Time->format($time, \IntlDateFormatter::FULL);
-        $expected = 'jeudi 14 janvier 2010 13:59:28 UTC';
-        $this->assertTimeFormat($expected, $result);
+        $this->assertContains('jeudi 14 janvier 2010', $result);
+        $this->assertContains('13:59:28', $result);
     }
 
     /**