diff --git a/core/composer.json b/core/composer.json index 5f64514..3e62958 100644 --- a/core/composer.json +++ b/core/composer.json @@ -3,6 +3,8 @@ "description": "Drupal is an open source content management platform powering millions of websites and applications.", "type": "drupal-core", "license": "GPL-2.0+", + "minimum-stability": "dev", + "prefer-stable": true, "require": { "php": ">=5.4.5", "sdboyer/gliph": "0.1.*", @@ -31,7 +33,8 @@ "behat/mink": "~1.6", "behat/mink-goutte-driver": "~1.1", "fabpot/goutte": "^2.0.3", - "masterminds/html5": "~2.1" + "masterminds/html5": "~2.1", + "symfony/phpunit-bridge": "^3.0@dev" }, "autoload": { "psr-4": { diff --git a/core/composer.lock b/core/composer.lock index efa5529..baf37be 100644 --- a/core/composer.lock +++ b/core/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "ba1a97bf2c0bcef4fb771231a4c1fbdb", + "hash": "6d83b32631c4978a1a9562c503c50974", "packages": [ { "name": "behat/mink", @@ -2662,6 +2662,58 @@ "time": "2015-04-01 16:55:26" }, { + "name": "symfony/phpunit-bridge", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/symfony/phpunit-bridge.git", + "reference": "242cbb7b4cb7b15c4987a59e85543bdfa8a4c720" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/242cbb7b4cb7b15c4987a59e85543bdfa8a4c720", + "reference": "242cbb7b4cb7b15c4987a59e85543bdfa8a4c720", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "suggest": { + "symfony/debug": "For tracking deprecated interfaces usages at runtime with DebugClassLoader" + }, + "type": "symfony-bridge", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Bridge\\PhpUnit\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony PHPUnit Bridge", + "homepage": "https://symfony.com", + "time": "2015-05-12 15:48:43" + }, + { "name": "symfony/process", "version": "v2.6.6", "target-dir": "Symfony/Component/Process", @@ -3220,11 +3272,12 @@ ], "packages-dev": [], "aliases": [], - "minimum-stability": "stable", + "minimum-stability": "dev", "stability-flags": { - "symfony/validator": 20 + "symfony/validator": 20, + "symfony/phpunit-bridge": 20 }, - "prefer-stable": false, + "prefer-stable": true, "prefer-lowest": false, "platform": { "php": ">=5.4.5" diff --git a/core/phpunit.xml.dist b/core/phpunit.xml.dist index 743bf08..f23d50d 100644 --- a/core/phpunit.xml.dist +++ b/core/phpunit.xml.dist @@ -10,6 +10,7 @@ + diff --git a/core/tests/bootstrap.php b/core/tests/bootstrap.php index fd980a4..a4114ed 100644 --- a/core/tests/bootstrap.php +++ b/core/tests/bootstrap.php @@ -6,6 +6,7 @@ * * @see phpunit.xml.dist */ +use Symfony\Bridge\PhpUnit\DeprecationErrorHandler; /** * Finds all valid extension directories recursively within a given directory. @@ -89,3 +90,5 @@ function drupal_phpunit_register_extension_dirs(Composer\Autoload\ClassLoader $l // Set the default timezone. While this doesn't cause any tests to fail, PHP // complains if 'date.timezone' is not set in php.ini. date_default_timezone_set('UTC'); + +DeprecationErrorHandler::register(); diff --git a/core/vendor/composer/autoload_files.php b/core/vendor/composer/autoload_files.php index 853f9a0..65dad6d 100644 --- a/core/vendor/composer/autoload_files.php +++ b/core/vendor/composer/autoload_files.php @@ -6,6 +6,7 @@ $baseDir = dirname($vendorDir); return array( + $vendorDir . '/symfony/phpunit-bridge/bootstrap.php', $vendorDir . '/react/promise/src/functions_include.php', $baseDir . '/lib/Drupal.php', ); diff --git a/core/vendor/composer/autoload_psr4.php b/core/vendor/composer/autoload_psr4.php index ea6ef86..ea75416 100644 --- a/core/vendor/composer/autoload_psr4.php +++ b/core/vendor/composer/autoload_psr4.php @@ -10,6 +10,7 @@ 'Zend\\Feed\\' => array($vendorDir . '/zendframework/zend-feed'), 'Zend\\Escaper\\' => array($vendorDir . '/zendframework/zend-escaper'), 'Symfony\\Cmf\\Component\\Routing\\' => array($vendorDir . '/symfony-cmf/routing'), + 'Symfony\\Bridge\\PhpUnit\\' => array($vendorDir . '/symfony/phpunit-bridge'), 'React\\Promise\\' => array($vendorDir . '/react/promise/src'), 'Masterminds\\' => array($vendorDir . '/masterminds/html5/src'), 'GuzzleHttp\\Stream\\' => array($vendorDir . '/guzzlehttp/streams/src'), diff --git a/core/vendor/composer/installed.json b/core/vendor/composer/installed.json index caf7426..838e987 100644 --- a/core/vendor/composer/installed.json +++ b/core/vendor/composer/installed.json @@ -3325,5 +3325,59 @@ ], "description": "Symfony Validator Component", "homepage": "https://symfony.com" + }, + { + "name": "symfony/phpunit-bridge", + "version": "dev-master", + "version_normalized": "9999999-dev", + "source": { + "type": "git", + "url": "https://github.com/symfony/phpunit-bridge.git", + "reference": "242cbb7b4cb7b15c4987a59e85543bdfa8a4c720" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/242cbb7b4cb7b15c4987a59e85543bdfa8a4c720", + "reference": "242cbb7b4cb7b15c4987a59e85543bdfa8a4c720", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "suggest": { + "symfony/debug": "For tracking deprecated interfaces usages at runtime with DebugClassLoader" + }, + "time": "2015-05-12 15:48:43", + "type": "symfony-bridge", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "installation-source": "source", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Bridge\\PhpUnit\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony PHPUnit Bridge", + "homepage": "https://symfony.com" } ] diff --git a/core/vendor/symfony/phpunit-bridge/DeprecationErrorHandler.php b/core/vendor/symfony/phpunit-bridge/DeprecationErrorHandler.php new file mode 100644 index 0000000..fd2a135 --- /dev/null +++ b/core/vendor/symfony/phpunit-bridge/DeprecationErrorHandler.php @@ -0,0 +1,135 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\PhpUnit; + +/** + * Catch deprecation notices and print a summary report at the end of the test suite + * + * @author Nicolas Grekas + */ +class DeprecationErrorHandler +{ + private static $isRegistered = false; + + public static function register($mode = false) + { + if (self::$isRegistered) { + return; + } + $deprecations = array( + 'remainingCount' => 0, + 'legacyCount' => 0, + 'otherCount' => 0, + 'remaining' => array(), + 'legacy' => array(), + 'other' => array(), + ); + $deprecationHandler = function ($type, $msg, $file, $line, $context) use (&$deprecations, $mode) { + if (E_USER_DEPRECATED !== $type) { + return \PHPUnit_Util_ErrorHandler::handleError($type, $msg, $file, $line, $context); + } + + $trace = debug_backtrace(PHP_VERSION_ID >= 50400 ? DEBUG_BACKTRACE_IGNORE_ARGS | DEBUG_BACKTRACE_PROVIDE_OBJECT : true); + + $i = count($trace); + while (isset($trace[--$i]['class']) && ('ReflectionMethod' === $trace[$i]['class'] || 0 === strpos($trace[$i]['class'], 'PHPUnit_'))) { + // No-op + } + + if (isset($trace[$i]['object']) || isset($trace[$i]['class'])) { + $class = isset($trace[$i]['object']) ? get_class($trace[$i]['object']) : $trace[$i]['class']; + $method = $trace[$i]['function']; + + $group = 0 === strpos($method, 'testLegacy') || 0 === strpos($method, 'provideLegacy') || 0 === strpos($method, 'getLegacy') || strpos($class, '\Legacy') || in_array('legacy', \PHPUnit_Util_Test::getGroups($class, $method), true) ? 'legacy' : 'remaining'; + + if ('legacy' !== $group && 'weak' !== $mode) { + $ref =& $deprecations[$group][$msg]['count']; + ++$ref; + $ref =& $deprecations[$group][$msg][$class.'::'.$method]; + ++$ref; + } + } else { + $group = 'other'; + $ref =& $deprecations[$group][$msg]['count']; + ++$ref; + } + ++$deprecations[$group.'Count']; + }; + $oldErrorHandler = set_error_handler($deprecationHandler); + + if (null !== $oldErrorHandler) { + restore_error_handler(); + if (array('PHPUnit_Util_ErrorHandler', 'handleError') === $oldErrorHandler) { + restore_error_handler(); + self::register($mode); + } + } else { + self::$isRegistered = true; + if (self::hasColorSupport()) { + $colorize = function ($str, $red) { + $color = $red ? '41;37' : '43;30'; + + return "\x1B[{$color}m{$str}\x1B[0m"; + }; + } else { + $colorize = function ($str) {return $str;}; + } + register_shutdown_function(function () use ($mode, &$deprecations, $deprecationHandler, $colorize) { + $currErrorHandler = set_error_handler('var_dump'); + restore_error_handler(); + + if ($currErrorHandler !== $deprecationHandler) { + echo "\n", $colorize('THE ERROR HANDLER HAS CHANGED!', true), "\n"; + } + + $cmp = function ($a, $b) { + return $b['count'] - $a['count']; + }; + + foreach (array('remaining', 'legacy', 'other') as $group) { + if ($deprecations[$group.'Count']) { + echo "\n", $colorize(sprintf('%s deprecation notices (%d)', ucfirst($group), $deprecations[$group.'Count']), 'legacy' !== $group), "\n"; + + uasort($deprecations[$group], $cmp); + + foreach ($deprecations[$group] as $msg => $notices) { + echo "\n", rtrim($msg, '.'), ': ', $notices['count'], "x\n"; + + arsort($notices); + + foreach ($notices as $method => $count) { + if ('count' !== $method) { + echo ' ', $count, 'x in ', preg_replace('/(.*)\\\\(.*?::.*?)$/', '$2 from $1', $method), "\n"; + } + } + } + } + } + if (!empty($notices)) { + echo "\n"; + } + if ('weak' !== $mode && ($deprecations['remaining'] || $deprecations['other'])) { + exit(1); + } + }); + } + } + + private static function hasColorSupport() + { + if ('\\' === DIRECTORY_SEPARATOR) { + return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI'); + } + + return defined('STDOUT') && function_exists('posix_isatty') && @posix_isatty(STDOUT); + } +} diff --git a/core/vendor/symfony/phpunit-bridge/LICENSE b/core/vendor/symfony/phpunit-bridge/LICENSE new file mode 100644 index 0000000..ef1cde9 --- /dev/null +++ b/core/vendor/symfony/phpunit-bridge/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014-2015 Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/core/vendor/symfony/phpunit-bridge/README.md b/core/vendor/symfony/phpunit-bridge/README.md new file mode 100644 index 0000000..7d84a31 --- /dev/null +++ b/core/vendor/symfony/phpunit-bridge/README.md @@ -0,0 +1,43 @@ +PHPUnit Bridge +============== + +Provides utilities for PHPUnit, especially user deprecation notices management. + +It comes with the following features: + + * disable the garbage collector; + * auto-register `class_exists` to load Doctrine annotations; + * print a user deprecation notices summary at the end of the test suite. + +By default any non-legacy-tagged deprecation notice will make tests fail. +This can be changed by setting the SYMFONY_DEPRECATIONS_HELPER environment +variable to `weak`. This will make the bridge ignore deprecation notices and +is useful to projects that must use deprecated interfaces for backward +compatibility reasons. + +A summary of deprecation notices is displayed at the end of the test suite: + + * **Legacy** deprecation notices denote tests that explicitly test some legacy + interfaces. There are four ways to mark a test as legacy: + - make its class start with the `Legacy` prefix; + - make its method start with `testLegacy`; + - make its data provider start with `provideLegacy` or `getLegacy`; + - add the `@group legacy` annotation to its class or method. + * **Remaining/Other** deprecation notices are all other (non-legacy) + notices, grouped by message, test class and method. + +Usage +----- + +Add this bridge to the `require-dev` section of your composer.json file +(not in `require`) with e.g. `composer require --dev "symfony/phpunit-bridge"`. + +When running `phpunit`, you will see a summary of deprecation notices at the end +of the test suite. + +Deprecation notices in the **Remaining/Other** section need some thought. +You have to decide either to: + + * update your code to not use deprecated interfaces anymore, thus gaining better + forward compatibility; + * or move them to the **Legacy** section (by using one of the above way). diff --git a/core/vendor/symfony/phpunit-bridge/bootstrap.php b/core/vendor/symfony/phpunit-bridge/bootstrap.php new file mode 100644 index 0000000..1640895 --- /dev/null +++ b/core/vendor/symfony/phpunit-bridge/bootstrap.php @@ -0,0 +1,19 @@ +=5.5.9" + }, + "suggest": { + "symfony/debug": "For tracking deprecated interfaces usages at runtime with DebugClassLoader" + }, + "autoload": { + "files": [ "bootstrap.php" ], + "psr-4": { "Symfony\\Bridge\\PhpUnit\\": "" } + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + } +} diff --git a/core/vendor/symfony/phpunit-bridge/phpunit.xml.dist b/core/vendor/symfony/phpunit-bridge/phpunit.xml.dist new file mode 100644 index 0000000..7f631b2 --- /dev/null +++ b/core/vendor/symfony/phpunit-bridge/phpunit.xml.dist @@ -0,0 +1,28 @@ + + + + + + + + + + ./Tests/ + + + + + + ./ + + ./Tests + ./vendor + + + +