浏览代码

Merge branch 'master' into 3.next

Mark Story 8 年之前
父节点
当前提交
128ad9efad

+ 1 - 1
VERSION.txt

@@ -16,4 +16,4 @@
 // @license       https://opensource.org/licenses/mit-license.php MIT License
 // +--------------------------------------------------------------------------------------------+ //
 ////////////////////////////////////////////////////////////////////////////////////////////////////
-3.4.8
+3.4.9

+ 1 - 1
src/Auth/DefaultPasswordHasher.php

@@ -42,7 +42,7 @@ class DefaultPasswordHasher extends AbstractPasswordHasher
      *
      * @param string $password Plain text password to hash.
      * @return bool|string Password hash or false on failure
-     * @link https://book.cakephp.org/3.0/en/core-libraries/components/authentication.html#hashing-passwords
+     * @link https://book.cakephp.org/3.0/en/controllers/components/authentication.html#hashing-passwords
      */
     public function hash($password)
     {

+ 1 - 1
src/Database/Driver.php

@@ -386,7 +386,7 @@ abstract class Driver
     public function __debugInfo()
     {
         return [
-            'connected' => $this->isConnected()
+            'connected' => $this->_connection !== null
         ];
     }
 }

+ 1 - 6
src/TestSuite/Fixture/FixtureInjector.php

@@ -14,12 +14,7 @@
  */
 namespace Cake\TestSuite\Fixture;
 
-if (class_exists('PHPUnit_Runner_Version')) {
-    if (version_compare(\PHPUnit_Runner_Version::id(), '5.7', '<')) {
-        trigger_error(sprintf('Your PHPUnit Version must be at least 5.7.0 to use CakePHP Testsuite, found %s', \PHPUnit_Runner_Version::id()), E_USER_ERROR);
-    }
-    class_alias('PHPUnit_Framework_Test', 'PHPUnit\Framework\Test');
-}
+loadPHPUnitAliases();
 
 use Cake\TestSuite\TestCase;
 use PHPUnit\Framework\BaseTestListener;

+ 2 - 0
src/TestSuite/Fixture/FixtureManager.php

@@ -14,6 +14,8 @@
  */
 namespace Cake\TestSuite\Fixture;
 
+loadPHPUnitAliases();
+
 use Cake\Core\Configure;
 use Cake\Core\Exception\Exception;
 use Cake\Database\Schema\TableSchema;

+ 1 - 7
src/TestSuite/TestSuite.php

@@ -16,13 +16,7 @@
  */
 namespace Cake\TestSuite;
 
-if (class_exists('PHPUnit_Runner_Version')) {
-    if (version_compare(\PHPUnit_Runner_Version::id(), '5.7', '<')) {
-        trigger_error(sprintf('Your PHPUnit Version must be at least 5.7.0 to use CakePHP Testsuite, found %s', \PHPUnit_Runner_Version::id()), E_USER_ERROR);
-    }
-    class_alias('PHPUnit_Framework_TestSuite', 'PHPUnit\Framework\TestSuite');
-    class_alias('PHPUnit_Framework_AssertionFailedError', 'PHPUnit\Framework\AssertionFailedError');
-}
+loadPHPUnitAliases();
 
 use Cake\Filesystem\Folder;
 use PHPUnit\Framework\TestSuite as BaseTestSuite;

+ 5 - 5
src/Utility/Text.php

@@ -461,7 +461,7 @@ class Text
      * @param string|array $phrase The phrase or phrases that will be searched.
      * @param array $options An array of HTML attributes and options.
      * @return string The highlighted text
-     * @link https://book.cakephp.org/3.0/en/core-libraries/string.html#highlighting-substrings
+     * @link https://book.cakephp.org/3.0/en/core-libraries/text.html#highlighting-substrings
      */
     public static function highlight($text, $phrase, array $options = [])
     {
@@ -578,7 +578,7 @@ class Text
      * @param int $length Length of returned string, including ellipsis.
      * @param array $options An array of HTML attributes and options.
      * @return string Trimmed string.
-     * @link https://book.cakephp.org/3.0/en/core-libraries/string.html#truncating-text
+     * @link https://book.cakephp.org/3.0/en/core-libraries/text.html#truncating-text
      */
     public static function truncate($text, $length = 100, array $options = [])
     {
@@ -846,7 +846,7 @@ class Text
      * @param int $radius The amount of characters that will be returned on each side of the founded phrase
      * @param string $ellipsis Ending that will be appended
      * @return string Modified string
-     * @link https://book.cakephp.org/3.0/en/core-libraries/string.html#extracting-an-excerpt
+     * @link https://book.cakephp.org/3.0/en/core-libraries/text.html#extracting-an-excerpt
      */
     public static function excerpt($text, $phrase, $radius = 100, $ellipsis = '...')
     {
@@ -889,7 +889,7 @@ class Text
      * @param string|null $and The word used to join the last and second last items together with. Defaults to 'and'.
      * @param string $separator The separator used to join all the other items together. Defaults to ', '.
      * @return string The glued together string.
-     * @link https://book.cakephp.org/3.0/en/core-libraries/string.html#converting-an-array-to-sentence-form
+     * @link https://book.cakephp.org/3.0/en/core-libraries/text.html#converting-an-array-to-sentence-form
      */
     public static function toList(array $list, $and = null, $separator = ', ')
     {
@@ -998,7 +998,7 @@ class Text
      * @param mixed $default Value to be returned when invalid size was used, for example 'Unknown type'
      * @return mixed Number of bytes as integer on success, `$default` on failure if not false
      * @throws \InvalidArgumentException On invalid Unit type.
-     * @link https://book.cakephp.org/3.0/en/core-libraries/helpers/text.html
+     * @link https://book.cakephp.org/3.0/en/core-libraries/text.html#Cake\Utility\Text::parseFileSize
      */
     public static function parseFileSize($size, $default = false)
     {

+ 15 - 0
src/basics.php

@@ -140,3 +140,18 @@ if (!function_exists('dd')) {
         die(1);
     }
 }
+
+if (!function_exists('loadPHPUnitAliases')) {
+    /**
+     * Loads PHPUnit aliases
+     *
+     * This is an internal function used for backwards compatibility during
+     * fixture related tests.
+     *
+     * @return void
+     */
+    function loadPHPUnitAliases()
+    {
+        require_once dirname(__DIR__) . DS . 'tests' . DS . 'phpunit_aliases.php';
+    }
+}

+ 10 - 0
tests/phpunit_aliases.php

@@ -0,0 +1,10 @@
+<?php
+if (class_exists('PHPUnit_Runner_Version')) {
+    if (version_compare(\PHPUnit_Runner_Version::id(), '5.7', '<')) {
+        trigger_error(sprintf('Your PHPUnit Version must be at least 5.7.0 to use CakePHP Testsuite, found %s', \PHPUnit_Runner_Version::id()), E_USER_ERROR);
+    }
+
+    class_alias('PHPUnit_Framework_Test', 'PHPUnit\Framework\Test');
+    class_alias('PHPUnit_Framework_AssertionFailedError', 'PHPUnit\Framework\AssertionFailedError');
+    class_alias('PHPUnit_Framework_TestSuite', 'PHPUnit\Framework\TestSuite');
+}