Browse Source

Merge branch 'master' into 4.next

Mark Story 5 years ago
parent
commit
9a39b6fb98

+ 1 - 1
.appveyor.yml

@@ -18,7 +18,7 @@ services:
 
 environment:
   global:
-    db_dsn: 'sqlserver://sa:Password12!@.\SQL2012SP1/cakephp?MultipleActiveResultSets=false'
+    DB_URL: 'sqlserver://sa:Password12!@.\SQL2012SP1/cakephp?MultipleActiveResultSets=false'
 
 init:
   - SET PATH=C:\Program Files\OpenSSL;C:\php;%PATH%

+ 16 - 14
.github/workflows/ci.yml

@@ -27,23 +27,25 @@ jobs:
         image: redis
         ports:
           - 6379/tcp
-      postgres:
-        image: postgres
-        ports:
-          - 5432:5432
-        env:
-          POSTGRES_PASSWORD: postgres
 
     steps:
 
-    - name: Setup MySQL 8.0
+    - name: Setup MySQL latest
       if: matrix.db-type == 'mysql' && matrix.php-version == '7.2'
-      run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp --tmpfs /var/lib/mysql:rw --network=host -d mysql --default-authentication-plugin=mysql_native_password --disable-log-bin --innodb-flush-method=O_DIRECT_NO_FSYNC
+      run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp -p 3306:3306 -d mysql --default-authentication-plugin=mysql_native_password --disable-log-bin
 
     - name: Setup MySQL 5.6
       if: matrix.db-type == 'mysql' && matrix.php-version == '7.4'
       run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp -p 3306:3306 -d mysql:5.6 --character-set-server=utf8
 
+    - name: Setup PostgreSQL latest
+      if: matrix.db-type == 'pgsql' && matrix.php-version == '7.2'
+      run: docker run --rm --name=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=cakephp -p 5432:5432 -d postgres
+
+    - name: Setup PostgreSQL 9.4
+      if: matrix.db-type == 'pgsql' && matrix.php-version == '7.4'
+      run: docker run --rm --name=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=cakephp -p 5432:5432 -d postgres:9.4
+
     - uses: getong/mariadb-action@v1.1
       if: matrix.db-type == 'mariadb'
       with:
@@ -96,11 +98,11 @@ jobs:
       env:
         REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
       run: |
-        if [[ ${{ matrix.db-type }} == 'sqlite' ]]; then export DB_DSN='sqlite:///:memory:'; fi
-        if [[ ${{ matrix.db-type }} == 'mysql' && ${{ matrix.php-version }} == '7.2' ]]; then export DB_DSN='mysql://root:root@127.0.0.1/cakephp?init[]=SET sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"'; fi
-        if [[ ${{ matrix.db-type }} == 'mysql' && ${{ matrix.php-version }} == '7.4' ]]; then export DB_DSN='mysql://root:root@127.0.0.1/cakephp?encoding=utf8'; fi
-        if [[ ${{ matrix.db-type }} == 'mariadb' ]]; then export DB_DSN='mysql://root:root@127.0.0.1/cakephp?init[]=SET sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"'; fi
-        if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then export DB_DSN='postgres://postgres:postgres@127.0.0.1/postgres'; fi
+        if [[ ${{ matrix.db-type }} == 'sqlite' ]]; then export DB_URL='sqlite:///:memory:'; fi
+        if [[ ${{ matrix.db-type }} == 'mysql' && ${{ matrix.php-version }} == '7.2' ]]; then export DB_URL='mysql://root:root@127.0.0.1/cakephp?init[]=SET sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"'; fi
+        if [[ ${{ matrix.db-type }} == 'mysql' && ${{ matrix.php-version }} == '7.4' ]]; then export DB_URL='mysql://root:root@127.0.0.1/cakephp?encoding=utf8'; fi
+        if [[ ${{ matrix.db-type }} == 'mariadb' ]]; then export DB_URL='mysql://root:root@127.0.0.1/cakephp?init[]=SET sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"'; fi
+        if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then export DB_URL='postgres://postgres:postgres@127.0.0.1/postgres'; fi
 
         if [[ ${{ matrix.php-version }} == '7.2' ]]; then
           vendor/bin/phpunit
@@ -172,7 +174,7 @@ jobs:
 
     - name: Run PHPUnit
       env:
-        DB_DSN: 'sqlserver://@(localdb)\MSSQLLocalDB/cakephp'
+        DB_URL: 'sqlserver://@(localdb)\MSSQLLocalDB/cakephp'
       run: |
           vendor/bin/phpunit --verbose
 

+ 4 - 4
.travis.yml

@@ -20,16 +20,16 @@ php:
 
 env:
   matrix:
-    - DB=mysql DB_DSN='mysql://root@127.0.0.1/cakephp_test?init[]=SET sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"'
-    - DB=pgsql DB_DSN='postgres://postgres@127.0.0.1/cakephp_test'
-    - DB=sqlite DB_DSN='sqlite:///:memory:'
+    - DB=mysql DB_URL='mysql://root@127.0.0.1/cakephp_test?init[]=SET sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"'
+    - DB=pgsql DB_URL='postgres://postgres@127.0.0.1/cakephp_test'
+    - DB=sqlite DB_URL='sqlite:///:memory:'
 
 matrix:
   include:
     - php: 7.2
       env: PREFER_LOWEST=1
     - php: nightly
-      env: DB=sqlite DB_DSN='sqlite:///:memory:'
+      env: DB=sqlite DB_URL='sqlite:///:memory:'
 
   allow_failures:
     - php: nightly

+ 1 - 1
composer.json

@@ -112,7 +112,7 @@
             "@phpstan",
             "@psalm"
         ],
-        "stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:0.12.32 psalm/phar:~3.12.2 && mv composer.backup composer.json"
+        "stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:0.12.32 psalm/phar:~3.13.1 && mv composer.backup composer.json"
     },
     "config": {
         "sort-packages": true,

+ 4 - 4
phpunit.xml.dist

@@ -48,16 +48,16 @@
         <ini name="error_reporting" value="32767"/>
 
         <!-- SQLite
-        <env name="DB_DSN" value="sqlite:///:memory:"/>
+        <env name="DB_URL" value="sqlite:///:memory:"/>
         -->
         <!-- Postgres
-        <env name="DB_DSN" value="postgres://localhost/cake_test?timezone=UTC"/>
+        <env name="DB_URL" value="postgres://localhost/cake_test?timezone=UTC"/>
         -->
         <!-- Mysql
-        <env name="DB_DSN" value="mysql://localhost/cake_test?timezone=UTC"/>
+        <env name="DB_URL" value="mysql://localhost/cake_test?timezone=UTC"/>
         -->
         <!-- SQL Server
-        <env name="DB_DSN" value="sqlserver://localhost/cake_test?timezone=UTC"/>
+        <env name="DB_URL" value="sqlserver://localhost/cake_test?timezone=UTC"/>
         -->
     </php>
 </phpunit>

+ 0 - 2
src/Core/PluginCollection.php

@@ -122,8 +122,6 @@ class PluginCollection implements Iterator, Countable
      */
     public function findPath(string $name): string
     {
-        $this->loadConfig();
-
         $path = Configure::read('plugins.' . $name);
         if ($path) {
             return $path;

+ 7 - 7
src/I18n/Date.php

@@ -40,10 +40,10 @@ class Date extends MutableDate implements I18nDateTimeInterface
      * will be used for formatting the date part of the object and the second position
      * will be used to format the time part.
      *
-     * @var string|array|int
+     * @var string|int|int[]
      * @see \Cake\I18n\DateFormatTrait::i18nFormat()
      */
-    protected static $_toStringFormat = [IntlDateFormatter::SHORT, -1];
+    protected static $_toStringFormat = [IntlDateFormatter::SHORT, IntlDateFormatter::NONE];
 
     /**
      * The format to use when converting this object to JSON.
@@ -56,7 +56,7 @@ class Date extends MutableDate implements I18nDateTimeInterface
      * will be used for formatting the date part of the object and the second position
      * will be used to format the time part.
      *
-     * @var string|array|int|\Closure
+     * @var string|int|int[]|\Closure
      * @see \Cake\I18n\Time::i18nFormat()
      */
     protected static $_jsonEncodeFormat = 'yyyy-MM-dd';
@@ -65,10 +65,10 @@ class Date extends MutableDate implements I18nDateTimeInterface
      * The format to use when formatting a time using `Cake\I18n\Date::timeAgoInWords()`
      * and the difference is more than `Cake\I18n\Date::$wordEnd`
      *
-     * @var string|array|int
+     * @var string|int|int[]
      * @see \Cake\I18n\DateFormatTrait::parseDate()
      */
-    public static $wordFormat = [IntlDateFormatter::SHORT, -1];
+    public static $wordFormat = [IntlDateFormatter::SHORT, IntlDateFormatter::NONE];
 
     /**
      * The format to use when formatting a time using `Cake\I18n\Date::nice()`
@@ -81,10 +81,10 @@ class Date extends MutableDate implements I18nDateTimeInterface
      * will be used for formatting the date part of the object and the second position
      * will be used to format the time part.
      *
-     * @var string|array|int
+     * @var string|int|int[]
      * @see \Cake\I18n\DateFormatTrait::nice()
      */
-    public static $niceFormat = [IntlDateFormatter::MEDIUM, -1];
+    public static $niceFormat = [IntlDateFormatter::MEDIUM, IntlDateFormatter::NONE];
 
     /**
      * The format to use when formatting a time using `Date::timeAgoInWords()`

+ 28 - 34
src/I18n/DateFormatTrait.php

@@ -21,7 +21,6 @@ use Closure;
 use DateTime;
 use DateTimeZone;
 use IntlDateFormatter;
-use InvalidArgumentException;
 use RuntimeException;
 
 /**
@@ -36,7 +35,7 @@ trait DateFormatTrait
      *
      * Use static::setDefaultLocale() and static::getDefaultLocale() instead.
      *
-     * @var string
+     * @var string|null
      */
     protected static $defaultLocale;
 
@@ -171,7 +170,7 @@ trait DateFormatTrait
      * You can control the default locale used through `Time::setDefaultLocale()`.
      * If empty, the default will be taken from the `intl.default_locale` ini config.
      *
-     * @param string|int|array|null $format Format string.
+     * @param string|int|int[]|null $format Format string.
      * @param string|\DateTimeZone|null $timezone Timezone string or DateTimeZone object
      * in which the date will be displayed. The timezone stored for this object will not
      * be changed.
@@ -203,18 +202,18 @@ trait DateFormatTrait
      * Implements what IntlDateFormatter::formatObject() is in PHP 5.5+
      *
      * @param \DateTime|\DateTimeImmutable $date Date.
-     * @param string|int|array $format Format.
+     * @param string|int|int[] $format Format.
      * @param string|null $locale The locale name in which the date should be displayed.
      * @return string
      */
     protected function _formatObject($date, $format, ?string $locale): string
     {
-        $pattern = $timeFormat = null;
+        $pattern = '';
 
         if (is_array($format)) {
             [$dateFormat, $timeFormat] = $format;
-        } elseif (is_numeric($format)) {
-            $dateFormat = $format;
+        } elseif (is_int($format)) {
+            $dateFormat = $timeFormat = $format;
         } else {
             $dateFormat = $timeFormat = IntlDateFormatter::FULL;
             $pattern = $format;
@@ -242,11 +241,11 @@ trait DateFormatTrait
             }
             $formatter = datefmt_create(
                 $locale,
-                (int)$dateFormat,
-                (int)$timeFormat,
+                $dateFormat,
+                $timeFormat,
                 $timezone,
                 $calendar,
-                (string)$pattern
+                $pattern
             );
             if ($formatter === false) {
                 throw new RuntimeException(
@@ -290,7 +289,7 @@ trait DateFormatTrait
      * will be used for formatting the date part of the object and the second position
      * will be used to format the time part.
      *
-     * @param string|array|int $format Format.
+     * @param string|int|int[] $format Format.
      * @return void
      */
     public static function setToStringFormat($format): void
@@ -325,41 +324,36 @@ trait DateFormatTrait
      * ```
      *  $time = Time::parseDateTime('10/13/2013 12:54am');
      *  $time = Time::parseDateTime('13 Oct, 2013 13:54', 'dd MMM, y H:mm');
-     *  $time = Time::parseDateTime('10/10/2015', [IntlDateFormatter::SHORT, -1]);
+     *  $time = Time::parseDateTime('10/10/2015', [IntlDateFormatter::SHORT, IntlDateFormatter::NONE]);
      * ```
      *
      * @param string $time The time string to parse.
-     * @param string|int[]|null $format Any format accepted by IntlDateFormatter.
+     * @param string|int|int[]|null $format Any format accepted by IntlDateFormatter.
      * @param \DateTimeZone|string|null $tz The timezone for the instance
      * @return static|null
-     * @throws \InvalidArgumentException If $format is a single int instead of array of constants
      */
     public static function parseDateTime(string $time, $format = null, $tz = null)
     {
-        $dateFormat = $format ?: static::$_toStringFormat;
-        $timeFormat = $pattern = null;
+        $format = $format ?? static::$_toStringFormat;
+        $pattern = '';
 
-        if (is_array($dateFormat)) {
-            [$newDateFormat, $timeFormat] = $dateFormat;
-            $dateFormat = $newDateFormat;
+        if (is_array($format)) {
+            [$dateFormat, $timeFormat] = $format;
+        } elseif (is_int($format)) {
+            $dateFormat = $timeFormat = $format;
         } else {
-            $pattern = $dateFormat;
-            $dateFormat = null;
-
-            if (is_int($pattern)) {
-                throw new InvalidArgumentException(
-                    'If $format is an IntlDateFormatter constant, must be an array.'
-                );
-            }
+            $dateFormat = $timeFormat = IntlDateFormatter::FULL;
+            $pattern = $format;
         }
 
+        $locale = static::$defaultLocale ?? I18n::getLocale();
         $formatter = datefmt_create(
-            (string)static::$defaultLocale,
-            $dateFormat ?? 0,
-            $timeFormat ?? 0,
+            $locale,
+            $dateFormat,
+            $timeFormat,
             $tz,
             null,
-            $pattern ?? ''
+            $pattern
         );
         $formatter->setLenient(static::$lenientParsing);
 
@@ -403,7 +397,7 @@ trait DateFormatTrait
     public static function parseDate(string $date, $format = null)
     {
         if (is_int($format)) {
-            $format = [$format, -1];
+            $format = [$format, IntlDateFormatter::NONE];
         }
         $format = $format ?: static::$wordFormat;
 
@@ -433,9 +427,9 @@ trait DateFormatTrait
     public static function parseTime(string $time, $format = null)
     {
         if (is_int($format)) {
-            $format = [-1, $format];
+            $format = [IntlDateFormatter::NONE, $format];
         }
-        $format = $format ?: [-1, IntlDateFormatter::SHORT];
+        $format = $format ?: [IntlDateFormatter::NONE, IntlDateFormatter::SHORT];
 
         return static::parseDateTime($time, $format);
     }

+ 6 - 6
src/I18n/FrozenDate.php

@@ -42,7 +42,7 @@ class FrozenDate extends ChronosDate implements I18nDateTimeInterface
      * will be used for formatting the date part of the object and the second position
      * will be used to format the time part.
      *
-     * @var string|array|int
+     * @var string|int|int[]
      * @see \Cake\I18n\DateFormatTrait::i18nFormat()
      */
     protected static $_toStringFormat = [IntlDateFormatter::SHORT, -1];
@@ -58,7 +58,7 @@ class FrozenDate extends ChronosDate implements I18nDateTimeInterface
      * will be used for formatting the date part of the object and the second position
      * will be used to format the time part.
      *
-     * @var string|array|int|\Closure
+     * @var string|int|int[]|\Closure
      * @see \Cake\I18n\Time::i18nFormat()
      */
     protected static $_jsonEncodeFormat = 'yyyy-MM-dd';
@@ -67,10 +67,10 @@ class FrozenDate extends ChronosDate implements I18nDateTimeInterface
      * The format to use when formatting a time using `Cake\I18n\Date::timeAgoInWords()`
      * and the difference is more than `Cake\I18n\Date::$wordEnd`
      *
-     * @var string|array|int
+     * @var string|int|int[]
      * @see \Cake\I18n\DateFormatTrait::parseDate()
      */
-    public static $wordFormat = [IntlDateFormatter::SHORT, -1];
+    public static $wordFormat = [IntlDateFormatter::SHORT, IntlDateFormatter::NONE];
 
     /**
      * The format to use when formatting a time using `Cake\I18n\Date::nice()`
@@ -83,10 +83,10 @@ class FrozenDate extends ChronosDate implements I18nDateTimeInterface
      * will be used for formatting the date part of the object and the second position
      * will be used to format the time part.
      *
-     * @var string|array|int
+     * @var string|int|int[]
      * @see \Cake\I18n\DateFormatTrait::nice()
      */
-    public static $niceFormat = [IntlDateFormatter::MEDIUM, -1];
+    public static $niceFormat = [IntlDateFormatter::MEDIUM, IntlDateFormatter::NONE];
 
     /**
      * The format to use when formatting a time using `Date::timeAgoInWords()`

+ 5 - 5
src/I18n/FrozenTime.php

@@ -43,7 +43,7 @@ class FrozenTime extends Chronos implements I18nDateTimeInterface
      * will be used for formatting the date part of the object and the second position
      * will be used to format the time part.
      *
-     * @var string|array|int
+     * @var string|int|int[]
      * @see \Cake\I18n\FrozenTime::i18nFormat()
      */
     protected static $_toStringFormat = [IntlDateFormatter::SHORT, IntlDateFormatter::SHORT];
@@ -59,7 +59,7 @@ class FrozenTime extends Chronos implements I18nDateTimeInterface
      * will be used for formatting the date part of the object and the second position
      * will be used to format the time part.
      *
-     * @var string|array|int|\Closure
+     * @var string|int|int[]|\Closure
      * @see \Cake\I18n\Time::i18nFormat()
      */
     protected static $_jsonEncodeFormat = "yyyy-MM-dd'T'HH':'mm':'ssxxx";
@@ -75,7 +75,7 @@ class FrozenTime extends Chronos implements I18nDateTimeInterface
      * will be used for formatting the date part of the object and the second position
      * will be used to format the time part.
      *
-     * @var string|array|int
+     * @var string|int|int[]
      * @see \Cake\I18n\FrozenTime::nice()
      */
     public static $niceFormat = [IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT];
@@ -84,10 +84,10 @@ class FrozenTime extends Chronos implements I18nDateTimeInterface
      * The format to use when formatting a time using `Cake\I18n\FrozenTime::timeAgoInWords()`
      * and the difference is more than `Cake\I18n\FrozenTime::$wordEnd`
      *
-     * @var string|array|int
+     * @var string|int|int[]
      * @see \Cake\I18n\FrozenTime::timeAgoInWords()
      */
-    public static $wordFormat = [IntlDateFormatter::SHORT, -1];
+    public static $wordFormat = [IntlDateFormatter::SHORT, IntlDateFormatter::NONE];
 
     /**
      * The format to use when formatting a time using `Time::timeAgoInWords()`

+ 1 - 1
src/I18n/I18nDateTimeInterface.php

@@ -122,7 +122,7 @@ interface I18nDateTimeInterface extends ChronosInterface, JsonSerializable
     /**
      * Sets the default format used when type converting instances of this type to string
      *
-     * @param string|array|int $format Format.
+     * @param string|int|int[] $format Format.
      * @return void
      */
     public static function setToStringFormat($format): void;

+ 5 - 5
src/I18n/Time.php

@@ -41,7 +41,7 @@ class Time extends MutableDateTime implements I18nDateTimeInterface
      * will be used for formatting the date part of the object and the second position
      * will be used to format the time part.
      *
-     * @var string|array|int
+     * @var string|int|int[]
      * @see \Cake\I18n\Time::i18nFormat()
      */
     protected static $_toStringFormat = [IntlDateFormatter::SHORT, IntlDateFormatter::SHORT];
@@ -57,7 +57,7 @@ class Time extends MutableDateTime implements I18nDateTimeInterface
      * will be used for formatting the date part of the object and the second position
      * will be used to format the time part.
      *
-     * @var string|array|int|\Closure
+     * @var string|int|int[]|\Closure
      * @see \Cake\I18n\Time::i18nFormat()
      */
     protected static $_jsonEncodeFormat = "yyyy-MM-dd'T'HH':'mm':'ssxxx";
@@ -73,7 +73,7 @@ class Time extends MutableDateTime implements I18nDateTimeInterface
      * will be used for formatting the date part of the object and the second position
      * will be used to format the time part.
      *
-     * @var string|array|int
+     * @var string|int|int[]
      * @see \Cake\I18n\Time::nice()
      */
     public static $niceFormat = [IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT];
@@ -82,10 +82,10 @@ class Time extends MutableDateTime implements I18nDateTimeInterface
      * The format to use when formatting a time using `Cake\I18n\Time::timeAgoInWords()`
      * and the difference is more than `Cake\I18n\Time::$wordEnd`
      *
-     * @var string|array|int
+     * @var string|int|int[]
      * @see \Cake\I18n\Time::timeAgoInWords()
      */
-    public static $wordFormat = [IntlDateFormatter::SHORT, -1];
+    public static $wordFormat = [IntlDateFormatter::SHORT, IntlDateFormatter::NONE];
 
     /**
      * The format to use when formatting a time using `Time::timeAgoInWords()`

+ 1 - 14
tests/TestCase/I18n/TimeTest.php

@@ -467,7 +467,7 @@ class TimeTest extends TestCase
         $expected = 'Thursday, Dey 24, 1388 at 1:59:28 PM GMT';
         $this->assertTimeFormat($expected, $result);
 
-        $result = $time->i18nFormat(\IntlDateFormatter::SHORT, null, 'fa-IR@calendar=persian');
+        $result = $time->i18nFormat([\IntlDateFormatter::SHORT, \IntlDateFormatter::FULL], null, 'fa-IR@calendar=persian');
         $expected = '۱۳۸۸/۱۰/۲۴،‏ ۱۳:۵۹:۲۸ GMT';
         $this->assertTimeFormat($expected, $result);
 
@@ -854,19 +854,6 @@ class TimeTest extends TestCase
     }
 
     /**
-     * Test passing incorrect formatter options to parseDateTime
-     *
-     * @dataProvider classNameProvider
-     * @return void
-     */
-    public function testParseDateTimeInvalidFormat($class)
-    {
-        $this->expectException(\InvalidArgumentException::class);
-        $this->expectExceptionMessage('If $format is an IntlDateFormatter constant, must be an array.');
-        $time = $class::parseDateTime('10/13/2013 12:54am', IntlDateFormatter::SHORT);
-    }
-
-    /**
      * Tests parsing a string into a Time object based on the locale format.
      *
      * @dataProvider classNameProvider

+ 1 - 1
tests/TestCase/ORM/QueryRegressionTest.php

@@ -1686,7 +1686,7 @@ class QueryRegressionTest extends TestCase
     {
         $this->loadFixtures('Comments');
         $table = $this->getTableLocator()->get('Comments');
-        $table->updateAll(['updated' => Time::tomorrow()], ['id' => 6]);
+        $table->updateAll(['updated' => Time::now()->addDays(2)], ['id' => 6]);
         $query = $table->find();
         $result = $query->where(['updated >' => $query->func()->now('datetime')])->first();
         $this->assertSame(6, $result->id);

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

@@ -563,7 +563,7 @@ class TimeHelperTest extends TestCase
         $this->Time->setConfig('outputTimezone', 'America/Vancouver');
 
         $time = strtotime('Thu Jan 14 8:59:28 2010 UTC');
-        $result = $this->Time->i18nFormat($time, \IntlDateFormatter::SHORT);
+        $result = $this->Time->i18nFormat($time, [\IntlDateFormatter::SHORT, \IntlDateFormatter::FULL]);
         $expected = '1/14/10, 12:59:28 AM';
         $this->assertStringStartsWith($expected, $result);
     }

+ 4 - 4
tests/bootstrap.php

@@ -97,12 +97,12 @@ Cache::setConfig([
 ]);
 
 // Ensure default test connection is defined
-if (!getenv('DB_DSN')) {
-    putenv('DB_DSN=sqlite:///:memory:');
+if (!getenv('DB_URL')) {
+    putenv('DB_URL=sqlite:///:memory:');
 }
 
-ConnectionManager::setConfig('test', ['url' => getenv('DB_DSN')]);
-ConnectionManager::setConfig('test_custom_i18n_datasource', ['url' => getenv('DB_DSN')]);
+ConnectionManager::setConfig('test', ['url' => getenv('DB_URL')]);
+ConnectionManager::setConfig('test_custom_i18n_datasource', ['url' => getenv('DB_URL')]);
 
 Configure::write('Session', [
     'defaults' => 'php',