Merge branch '2.8'
* 2.8: [ci] Force update of ./phpunit deps [PhpUnitBridge] fix typo [Bridge\PhpUnit] Display the stack trace of a deprecation on-demand [Form] Fixed: Duplicate choice labels are remembered when using "choices_as_values" = false [Process] Don't catch RuntimeException when it complicates tests debugging [appveyor] Workaround transient segfault when APCu is enabled Conflicts: appveyor.yml src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
This commit is contained in:
commit
ba3afdb189
|
@ -38,7 +38,7 @@ before_install:
|
|||
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi;
|
||||
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = mongo.so" >> $INI_FILE; fi;
|
||||
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = memcache.so" >> $INI_FILE; fi;
|
||||
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.7 && echo "apc.enable_cli = 1" >> $INI_FILE) || echo "Let's continue without apcu extension"; fi;
|
||||
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.8 && echo "apc.enable_cli = 1" >> $INI_FILE) || echo "Let's continue without apcu extension"; fi;
|
||||
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then pecl install -f memcached-2.1.0 || echo "Let's continue without memcached extension"; fi;
|
||||
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]] && [ "$deps" = "no" ]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo "extension = $(pwd)/modules/symfony_debug.so" >> $INI_FILE); fi;
|
||||
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "extension = ldap.so" >> $INI_FILE; fi;
|
||||
|
|
|
@ -22,8 +22,8 @@ install:
|
|||
- IF %PHP%==1 7z x php-5.5.9-nts-Win32-VC11-x86.zip -y >nul
|
||||
- IF %PHP%==1 del /Q *.zip
|
||||
- IF %PHP%==1 cd ext
|
||||
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/apcu/4.0.7/php_apcu-4.0.7-5.5-nts-vc11-x86.zip
|
||||
- IF %PHP%==1 7z x php_apcu-4.0.7-5.5-nts-vc11-x86.zip -y >nul
|
||||
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/apcu/4.0.8/php_apcu-4.0.8-5.5-nts-vc11-x86.zip
|
||||
- IF %PHP%==1 7z x php_apcu-4.0.8-5.5-nts-vc11-x86.zip -y >nul
|
||||
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/memcache/3.0.8/php_memcache-3.0.8-5.5-nts-vc11-x86.zip
|
||||
- IF %PHP%==1 7z x php_memcache-3.0.8-5.5-nts-vc11-x86.zip -y >nul
|
||||
- IF %PHP%==1 del /Q *.zip
|
||||
|
|
5
phpunit
5
phpunit
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
// Please update when phpunit needs to be reinstalled with fresh deps:
|
||||
// Cache-Id-Version: 2015-11-18 14:14 UTC
|
||||
// Cache-Id-Version: 2015-11-28 09:05 UTC
|
||||
|
||||
use Symfony\Component\Process\ProcessUtils;
|
||||
|
||||
|
@ -164,7 +164,8 @@ if (isset($argv[1]) && 'symfony' === $argv[1]) {
|
|||
unlink($file);
|
||||
}
|
||||
|
||||
if ($procStatus) {
|
||||
// Fail on any individual component failures but ignore STATUS_STACK_BUFFER_OVERRUN (-1073740791) on Windows when APCu is enabled
|
||||
if ($procStatus && ('\\' !== DIRECTORY_SEPARATOR || !extension_loaded('apcu') || !ini_get('apc.enable_cli') || -1073740791 !== $procStatus)) {
|
||||
$exit = 1;
|
||||
echo "\033[41mKO\033[0m $component\n\n";
|
||||
} else {
|
||||
|
|
|
@ -47,16 +47,37 @@ class DeprecationErrorHandler
|
|||
// No-op
|
||||
}
|
||||
|
||||
if (0 !== error_reporting()) {
|
||||
$group = 'unsilenced';
|
||||
$ref = &$deprecations[$group][$msg]['count'];
|
||||
++$ref;
|
||||
} elseif (isset($trace[$i]['object']) || isset($trace[$i]['class'])) {
|
||||
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 (0 !== error_reporting()) {
|
||||
$group = 'unsilenced';
|
||||
} elseif (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)
|
||||
) {
|
||||
$group = 'legacy';
|
||||
} else {
|
||||
$group = 'remaining';
|
||||
}
|
||||
|
||||
if (isset($mode[0]) && '/' === $mode[0] && preg_match($mode, $class.'::'.$method)) {
|
||||
$e = new \Exception($msg);
|
||||
$r = new \ReflectionProperty($e, 'trace');
|
||||
$r->setAccessible(true);
|
||||
$r->setValue($e, array_slice($trace, 1, $i));
|
||||
|
||||
echo "\n".ucfirst($group).' deprecation triggered by '.$class.'::'.$method.':';
|
||||
echo "\n".$msg;
|
||||
echo "\nStack trace:";
|
||||
echo "\n".str_replace(' '.getcwd().DIRECTORY_SEPARATOR, ' ', $e->getTraceAsString());
|
||||
echo "\n";
|
||||
|
||||
exit(1);
|
||||
}
|
||||
if ('legacy' !== $group && 'weak' !== $mode) {
|
||||
$ref = &$deprecations[$group][$msg]['count'];
|
||||
++$ref;
|
||||
|
@ -78,7 +99,7 @@ class DeprecationErrorHandler
|
|||
restore_error_handler();
|
||||
self::register($mode);
|
||||
}
|
||||
} else {
|
||||
} elseif (!isset($mode[0]) || '/' !== $mode[0]) {
|
||||
self::$isRegistered = true;
|
||||
if (self::hasColorSupport()) {
|
||||
$colorize = function ($str, $red) {
|
||||
|
|
|
@ -8,7 +8,8 @@ It comes with the following features:
|
|||
* disable the garbage collector;
|
||||
* enforce a consistent `C` locale;
|
||||
* auto-register `class_exists` to load Doctrine annotations;
|
||||
* print a user deprecation notices summary at the end of the test suite.
|
||||
* print a user deprecation notices summary at the end of the test suite;
|
||||
* display the stack trace of a deprecation on-demand.
|
||||
|
||||
By default any non-legacy-tagged or any non-@-silenced deprecation notices will
|
||||
make tests fail.
|
||||
|
@ -51,3 +52,9 @@ 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).
|
||||
|
||||
In case you need to inspect the stack trace of a particular deprecation triggered by
|
||||
one of your unit tests, you can set the `SYMFONY_DEPRECATIONS_HELPER` env var to
|
||||
a regexp that matches this test case's `class::method` name. For example,
|
||||
`SYMFONY_DEPRECATIONS_HELPER=/^MyTest::testMethod$/ phpunit` will stop your test
|
||||
suite once a deprecation is triggered by the `MyTest::testMethod` test.
|
||||
|
|
|
@ -41,6 +41,8 @@ use Symfony\Component\Form\Exception\InvalidArgumentException;
|
|||
* ```
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @deprecated since version 2.8, to be removed in 3.0. Use ArrayChoiceList instead.
|
||||
*/
|
||||
class ArrayKeyChoiceList extends ArrayChoiceList
|
||||
{
|
||||
|
|
|
@ -152,46 +152,37 @@ class SimpleProcessTest extends AbstractProcessTest
|
|||
|
||||
public function testStopTerminatesProcessCleanly()
|
||||
{
|
||||
try {
|
||||
$process = $this->getProcess(self::$phpBin.' -r "echo \'foo\'; sleep(1); echo \'bar\';"');
|
||||
$process->run(function () use ($process) {
|
||||
$process->stop();
|
||||
});
|
||||
} catch (\RuntimeException $e) {
|
||||
$this->fail('A call to stop() is not expected to cause wait() to throw a RuntimeException');
|
||||
}
|
||||
$this->assertTrue(true, 'A call to stop() is not expected to cause wait() to throw a RuntimeException');
|
||||
}
|
||||
|
||||
public function testKillSignalTerminatesProcessCleanly()
|
||||
{
|
||||
$this->expectExceptionIfPHPSigchild('Symfony\Component\Process\Exception\RuntimeException', 'This PHP has been compiled with --enable-sigchild. The process can not be signaled.');
|
||||
|
||||
try {
|
||||
$process = $this->getProcess(self::$phpBin.' -r "echo \'foo\'; sleep(1); echo \'bar\';"');
|
||||
$process->run(function () use ($process) {
|
||||
if ($process->isRunning()) {
|
||||
$process->signal(defined('SIGKILL') ? SIGKILL : 9);
|
||||
}
|
||||
});
|
||||
} catch (\RuntimeException $e) {
|
||||
$this->fail('A call to signal() is not expected to cause wait() to throw a RuntimeException');
|
||||
}
|
||||
$this->assertTrue(true, 'A call to signal() is not expected to cause wait() to throw a RuntimeException');
|
||||
}
|
||||
|
||||
public function testTermSignalTerminatesProcessCleanly()
|
||||
{
|
||||
$this->expectExceptionIfPHPSigchild('Symfony\Component\Process\Exception\RuntimeException', 'This PHP has been compiled with --enable-sigchild. The process can not be signaled.');
|
||||
|
||||
try {
|
||||
$process = $this->getProcess(self::$phpBin.' -r "echo \'foo\'; sleep(1); echo \'bar\';"');
|
||||
$process->run(function () use ($process) {
|
||||
if ($process->isRunning()) {
|
||||
$process->signal(defined('SIGTERM') ? SIGTERM : 15);
|
||||
}
|
||||
});
|
||||
} catch (\RuntimeException $e) {
|
||||
$this->fail('A call to signal() is not expected to cause wait() to throw a RuntimeException');
|
||||
}
|
||||
$this->assertTrue(true, 'A call to signal() is not expected to cause wait() to throw a RuntimeException');
|
||||
}
|
||||
|
||||
public function testStopWithTimeoutIsActuallyWorking()
|
||||
|
|
Reference in New Issue