Merge branch '4.3' into 4.4

* 4.3:
  Minor fixes
  [HttpClient] Minor fixes
  Use namespaced Phpunit classes
  [Messenger] Fixed ConsumeMessagesCommand configuration
  [Form] remove leftover int child phpdoc
  Support DateTimeInterface in IntlDateFormatter::format
  [PhpUnitBridge] fixed PHPUnit 8.3 compatibility: method handleError was renamed to __invoke
  fixed phpdocs
  Use PHPunit assertion
  [Intl] Order alpha2 to alpha3 mapping + phpdoc fixes
This commit is contained in:
Nicolas Grekas 2019-08-05 16:07:36 +02:00
commit 5ef437b5f4
29 changed files with 130 additions and 115 deletions

View File

@ -9,7 +9,7 @@ return PhpCsFixer\Config::create()
'@Symfony' => true,
'@Symfony:risky' => true,
'@PHPUnit75Migration:risky' => true,
'php_unit_dedicate_assert' => ['target' => '3.5'],
'php_unit_dedicate_assert' => ['target' => '5.6'],
'phpdoc_no_empty_return' => false, // triggers almost always false positive
'array_syntax' => ['syntax' => 'short'],
'fopen_flags' => false,

View File

@ -196,6 +196,7 @@ install:
git checkout -q FETCH_HEAD -- src/Symfony/Bridge/PhpUnit
SYMFONY_VERSION=$(cat src/Symfony/Bridge/PhpUnit/composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*')
sed -i 's/"symfony\/phpunit-bridge": ".*"/"symfony\/phpunit-bridge": "'$SYMFONY_VERSION'.x@dev"/' composer.json
rm -rf .phpunit
fi
- |

View File

@ -11,6 +11,7 @@
namespace Symfony\Bridge\PhpUnit;
use PHPUnit\Framework\TestResult;
use PHPUnit\Util\ErrorHandler;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Configuration;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Deprecation;
@ -49,6 +50,7 @@ class DeprecationErrorHandler
];
private static $isRegistered = false;
private static $isAtLeastPhpUnit83;
/**
* Registers and configures the deprecation handler.
@ -72,13 +74,15 @@ class DeprecationErrorHandler
return;
}
self::$isAtLeastPhpUnit83 = !class_exists('PHPUnit_Util_ErrorHandler') && method_exists(ErrorHandler::class, '__invoke');
$handler = new self();
$oldErrorHandler = set_error_handler([$handler, 'handleError']);
if (null !== $oldErrorHandler) {
restore_error_handler();
if ([ErrorHandler::class, 'handleError'] === $oldErrorHandler) {
if ($oldErrorHandler instanceof ErrorHandler || [ErrorHandler::class, 'handleError'] === $oldErrorHandler) {
restore_error_handler();
self::register($mode);
}
@ -98,7 +102,7 @@ class DeprecationErrorHandler
return $previousErrorHandler($type, $msg, $file, $line, $context);
}
return ErrorHandler::handleError($type, $msg, $file, $line, $context);
return \call_user_func(self::getPhpUnitErrorHandler(), $type, $msg, $file, $line, $context);
}
$deprecations[] = [error_reporting(), $msg, $file];
@ -115,7 +119,7 @@ class DeprecationErrorHandler
public function handleError($type, $msg, $file, $line, $context = [])
{
if ((E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) || !$this->getConfiguration()->isEnabled()) {
return ErrorHandler::handleError($type, $msg, $file, $line, $context);
return \call_user_func(self::getPhpUnitErrorHandler(), $type, $msg, $file, $line, $context);
}
$deprecation = new Deprecation($msg, debug_backtrace(), $file);
@ -310,6 +314,26 @@ class DeprecationErrorHandler
}
}
private static function getPhpUnitErrorHandler()
{
if (!self::$isAtLeastPhpUnit83) {
return 'PHPUnit\Util\ErrorHandler::handleError';
}
foreach (debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) {
if (isset($frame['object']) && $frame['object'] instanceof TestResult) {
return new ErrorHandler(
$frame['object']->getConvertDeprecationsToExceptions(),
$frame['object']->getConvertErrorsToExceptions(),
$frame['object']->getConvertNoticesToExceptions(),
$frame['object']->getConvertWarningsToExceptions()
);
}
}
return function () { return false; };
}
/**
* Returns true if STDOUT is defined and supports colorization.
*

View File

@ -15,7 +15,7 @@ use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
/**
* This trait is @internal
* This trait is @internal.
*/
trait PolyfillTestCaseTrait
{

View File

@ -24,7 +24,7 @@ class ProcessIsolationTest extends TestCase
public function testCallingOtherErrorHandler()
{
$this->expectException(\class_exists('PHPUnit_Framework_Exception') ? 'PHPUnit_Framework_Exception' : 'PHPUnit\Framework\Exception');
$this->expectException('PHPUnit\Framework\Exception');
$this->expectExceptionMessage('Test that PHPUnit\'s error handler fires.');
trigger_error('Test that PHPUnit\'s error handler fires.', E_USER_WARNING);

View File

@ -1501,7 +1501,7 @@ class Configuration implements ConfigurationInterface
->info('A comma separated list of hosts that do not require a proxy to be reached.')
->end()
->floatNode('timeout')
->info('Defaults to "default_socket_timeout" ini parameter.')
->info('The idle timeout, defaults to the "default_socket_timeout" ini parameter.')
->end()
->scalarNode('bindto')
->info('A network interface name, IP address, a host name or a UNIX socket to bind to.')

View File

@ -233,7 +233,7 @@ class ResolveInstanceofConditionalsPassTest extends TestCase
public function testProcessThrowsExceptionForArguments()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
$this->expectExceptionMessage('Autoconfigured instanceof for type "PHPUnit\Framework\TestCase" defines arguments but these are not supported and should be removed.');
$this->expectExceptionMessageRegExp('/Autoconfigured instanceof for type "PHPUnit[\\\\_]Framework[\\\\_]TestCase" defines arguments but these are not supported and should be removed\./');
$container = new ContainerBuilder();
$container->registerForAutoconfiguration(parent::class)
->addArgument('bar');

View File

@ -11,6 +11,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Config;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\ResourceCheckerInterface;
use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
@ -52,15 +53,15 @@ class ContainerParametersResourceCheckerTest extends TestCase
public function isFreshProvider()
{
yield 'not fresh on missing parameter' => [function (\PHPUnit\Framework\MockObject\MockObject $container) {
yield 'not fresh on missing parameter' => [function (MockObject $container) {
$container->method('hasParameter')->with('locales')->willReturn(false);
}, false];
yield 'not fresh on different value' => [function (\PHPUnit\Framework\MockObject\MockObject $container) {
yield 'not fresh on different value' => [function (MockObject $container) {
$container->method('getParameter')->with('locales')->willReturn(['nl', 'es']);
}, false];
yield 'fresh on every identical parameters' => [function (\PHPUnit\Framework\MockObject\MockObject $container) {
yield 'fresh on every identical parameters' => [function (MockObject $container) {
$container->expects($this->exactly(2))->method('hasParameter')->willReturn(true);
$container->expects($this->exactly(2))->method('getParameter')
->withConsecutive(

View File

@ -294,7 +294,7 @@ class FlattenExceptionTest extends TestCase
// assertEquals() does not like NAN values.
$this->assertEquals($array[$i][0], 'float');
$this->assertTrue(is_nan($array[$i++][1]));
$this->assertNan($array[$i++][1]);
}
public function testRecursionInArguments()

View File

@ -153,7 +153,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->copy($sourceFilePath, $targetFilePath);
$this->assertTrue(is_dir($targetFileDirectory));
$this->assertDirectoryExists($targetFileDirectory);
$this->assertFileExists($targetFilePath);
$this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
}
@ -185,7 +185,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->mkdir($directory);
$this->assertTrue(is_dir($directory));
$this->assertDirectoryExists($directory);
}
public function testMkdirCreatesDirectoriesFromArray()
@ -197,9 +197,9 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->mkdir($directories);
$this->assertTrue(is_dir($basePath.'1'));
$this->assertTrue(is_dir($basePath.'2'));
$this->assertTrue(is_dir($basePath.'3'));
$this->assertDirectoryExists($basePath.'1');
$this->assertDirectoryExists($basePath.'2');
$this->assertDirectoryExists($basePath.'3');
}
public function testMkdirCreatesDirectoriesFromTraversableObject()
@ -211,9 +211,9 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->mkdir($directories);
$this->assertTrue(is_dir($basePath.'1'));
$this->assertTrue(is_dir($basePath.'2'));
$this->assertTrue(is_dir($basePath.'3'));
$this->assertDirectoryExists($basePath.'1');
$this->assertDirectoryExists($basePath.'2');
$this->assertDirectoryExists($basePath.'3');
}
public function testMkdirCreatesDirectoriesFails()
@ -347,7 +347,7 @@ class FilesystemTest extends FilesystemTestCase
// create symlink to dir using trailing forward slash
$this->filesystem->symlink($basePath.'dir/', $basePath.'dir-link');
$this->assertTrue(is_dir($basePath.'dir-link'));
$this->assertDirectoryExists($basePath.'dir-link');
// create symlink to nonexistent dir
rmdir($basePath.'dir');
@ -821,7 +821,7 @@ class FilesystemTest extends FilesystemTestCase
$this->assertFalse(is_link($link));
$this->assertFalse(is_file($link));
$this->assertFalse(is_dir($link));
$this->assertDirectoryNotExists($link);
}
public function testSymlinkIsOverwrittenIfPointsToDifferentTarget()
@ -1150,8 +1150,8 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->mirror($sourcePath, $targetPath);
$this->assertTrue(is_dir($targetPath));
$this->assertTrue(is_dir($targetPath.'directory'));
$this->assertDirectoryExists($targetPath);
$this->assertDirectoryExists($targetPath.'directory');
$this->assertFileEquals($file1, $targetPath.'directory'.\DIRECTORY_SEPARATOR.'file1');
$this->assertFileEquals($file2, $targetPath.'file2');
@ -1184,7 +1184,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->mirror($sourcePath, $targetPath);
$this->assertTrue(is_dir($targetPath));
$this->assertDirectoryExists($targetPath);
$this->filesystem->remove($sourcePath);
}
@ -1203,7 +1203,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->mirror($sourcePath, $targetPath);
$this->assertTrue(is_dir($targetPath));
$this->assertDirectoryExists($targetPath);
$this->assertFileEquals($sourcePath.'file1', $targetPath.'link1');
$this->assertTrue(is_link($targetPath.\DIRECTORY_SEPARATOR.'link1'));
}
@ -1223,7 +1223,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->mirror($sourcePath, $targetPath);
$this->assertTrue(is_dir($targetPath));
$this->assertDirectoryExists($targetPath);
$this->assertFileEquals($sourcePath.'/nested/file1.txt', $targetPath.'link1/file1.txt');
$this->assertTrue(is_link($targetPath.\DIRECTORY_SEPARATOR.'link1'));
}
@ -1247,7 +1247,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->mirror($sourcePath, $targetPath);
$this->assertTrue(is_dir($targetPath));
$this->assertDirectoryExists($targetPath);
$this->assertFileEquals($sourcePath.'/nested/file1.txt', $targetPath.'link1/file1.txt');
$this->assertTrue(is_link($targetPath.\DIRECTORY_SEPARATOR.'link1'));
$this->assertEquals('\\' === \DIRECTORY_SEPARATOR ? realpath($sourcePath.'\nested') : 'nested', readlink($targetPath.\DIRECTORY_SEPARATOR.'link1'));
@ -1270,7 +1270,7 @@ class FilesystemTest extends FilesystemTestCase
chdir($oldPath);
$this->assertTrue(is_dir($targetPath));
$this->assertDirectoryExists($targetPath);
$this->assertFileExists($targetPath.'source');
$this->assertFileExists($targetPath.'target');
}
@ -1295,7 +1295,7 @@ class FilesystemTest extends FilesystemTestCase
chdir($oldPath);
$this->assertTrue(is_dir($targetPath));
$this->assertDirectoryExists($targetPath);
$this->assertFileExists($targetPath.'source');
$this->assertFileNotExists($targetPath.'target');
}

View File

@ -1365,11 +1365,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
} catch (\Exception $e) {
$expectedExceptionClass = 'Symfony\\Component\\Finder\\Exception\\AccessDeniedException';
if ($e instanceof \PHPUnit\Framework\ExpectationFailedException) {
$this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, 'PHPUnit_Framework_ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString()));
}
if ($e instanceof \PHPUnit\Framework\ExpectationFailedException) {
$this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, '\PHPUnit\Framework\ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString()));
$this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, 'PHPUnit\Framework\ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString()));
}
$this->assertInstanceOf($expectedExceptionClass, $e);

View File

@ -38,8 +38,6 @@ class Button implements \IteratorAggregate, FormInterface
/**
* Creates a new button from a form configuration.
*
* @param FormConfigInterface $config The button's configuration
*/
public function __construct(FormConfigInterface $config)
{
@ -128,10 +126,6 @@ class Button implements \IteratorAggregate, FormInterface
*
* This method should not be invoked.
*
* @param int|string|FormInterface $child
* @param null $type
* @param array $options
*
* @throws BadMethodCallException
*/
public function add($child, $type = null, array $options = [])

View File

@ -37,7 +37,7 @@ class MockResponse implements ResponseInterface
/**
* @param string|string[]|iterable $body The response body as a string or an iterable of strings,
* yielding an empty string simulates a timeout,
* yielding an empty string simulates an idle timeout,
* exceptions are turned to TransportException
*
* @see ResponseInterface::getInfo() for possible info, e.g. "response_headers"
@ -277,7 +277,7 @@ class MockResponse implements ResponseInterface
if (!\is_string($body)) {
foreach ($body as $chunk) {
if ('' === $chunk = (string) $chunk) {
// simulate a timeout
// simulate an idle timeout
$response->body[] = new ErrorChunk($offset);
} else {
$response->body[] = $chunk;

View File

@ -42,7 +42,7 @@ class NativeFileSessionHandlerTest extends TestCase
{
$handler = new NativeFileSessionHandler($savePath);
$this->assertEquals($expectedSavePath, ini_get('session.save_path'));
$this->assertTrue(is_dir(realpath($path)));
$this->assertDirectoryExists(realpath($path));
rmdir($path);
}

View File

@ -26,7 +26,7 @@ class RemoveEmptyControllerArgumentLocatorsPassTest extends TestCase
$resolver = $container->register('argument_resolver.service')->addArgument([]);
$container->register('stdClass', 'stdClass');
$container->register(parent::class, 'stdClass');
$container->register(TestCase::class, 'stdClass');
$container->register('c1', RemoveTestController1::class)->addTag('controller.service_arguments');
$container->register('c2', RemoveTestController2::class)->addTag('controller.service_arguments')
->addMethodCall('setTestCase', [new Reference('c1')]);

View File

@ -31,13 +31,16 @@ final class Countries extends ResourceBundle
*
* This list only contains "officially assigned ISO 3166-1 alpha-2" country codes.
*
* @return string[] an array of canonical ISO 3166 country codes
* @return string[] an array of canonical ISO 3166 alpha-2 country codes
*/
public static function getCountryCodes(): array
{
return self::readEntry(['Regions'], 'meta');
}
/**
* @param string $country Alpha2 country code
*/
public static function exists(string $country): bool
{
try {
@ -50,6 +53,8 @@ final class Countries extends ResourceBundle
}
/**
* Gets the country name from alpha2 code.
*
* @throws MissingResourceException if the country code does not exists
*/
public static function getName(string $country, string $displayLocale = null): string
@ -58,9 +63,11 @@ final class Countries extends ResourceBundle
}
/**
* Gets the list of country names indexed with alpha2 codes as keys.
*
* @return string[]
*/
public static function getNames($displayLocale = null)
public static function getNames($displayLocale = null): array
{
return self::asort(self::readEntry(['Names'], $displayLocale), $displayLocale);
}

View File

@ -176,7 +176,7 @@ class IntlDateFormatter
/**
* Format the date/time value (timestamp) as a string.
*
* @param int|\DateTime $timestamp The timestamp to format
* @param int|\DateTimeInterface $timestamp The timestamp to format
*
* @return string|bool The formatted value or false if formatting failed
*
@ -195,7 +195,7 @@ class IntlDateFormatter
// behave like the intl extension
$argumentError = null;
if (!\is_int($timestamp) && !$timestamp instanceof \DateTime) {
if (!\is_int($timestamp) && !$timestamp instanceof \DateTimeInterface) {
$argumentError = sprintf('datefmt_format: string \'%s\' is not numeric, which would be required for it to be a valid date', $timestamp);
}
@ -207,7 +207,7 @@ class IntlDateFormatter
return false;
}
if ($timestamp instanceof \DateTime) {
if ($timestamp instanceof \DateTimeInterface) {
$timestamp = $timestamp->getTimestamp();
}

View File

@ -22,7 +22,7 @@ use Symfony\Component\Intl\Exception\MissingResourceException;
final class Languages extends ResourceBundle
{
/**
* Returns all available languages.
* Returns all available languages as two-letter codes.
*
* Languages are returned as lowercase ISO 639-1 two-letter language codes.
* For languages that don't have a two-letter code, the ISO 639-2
@ -31,7 +31,7 @@ final class Languages extends ResourceBundle
* A full table of ISO 639 language codes can be found here:
* http://www-01.sil.org/iso639-3/codes.asp
*
* @return string[] an array of canonical ISO 639 language codes
* @return string[] an array of canonical ISO 639-1 language codes
*/
public static function getLanguageCodes(): array
{
@ -50,6 +50,8 @@ final class Languages extends ResourceBundle
}
/**
* Gets the language name from alpha2 code.
*
* @throws MissingResourceException if the language code does not exists
*/
public static function getName(string $language, string $displayLocale = null): string
@ -58,6 +60,8 @@ final class Languages extends ResourceBundle
}
/**
* Gets the list of language names indexed with alpha2 codes as keys.
*
* @return string[]
*/
public static function getNames(string $displayLocale = null): array
@ -66,7 +70,7 @@ final class Languages extends ResourceBundle
}
/**
* Returns the ISO 639-2 three-letter code of a language.
* Returns the ISO 639-2 three-letter code of a language, given a two-letter code.
*
* @throws MissingResourceException if the language has no corresponding three-letter code
*/

View File

@ -67,7 +67,7 @@ final class Locales extends ResourceBundle
/**
* @return string[]
*/
public static function getNames($displayLocale = null)
public static function getNames($displayLocale = null): array
{
return self::asort(self::readEntry(['Names'], $displayLocale), $displayLocale);
}

View File

@ -51,7 +51,7 @@ final class Scripts extends ResourceBundle
/**
* @return string[]
*/
public static function getNames($displayLocale = null)
public static function getNames($displayLocale = null): array
{
return self::asort(self::readEntry(['Names'], $displayLocale), $displayLocale);
}

View File

@ -76,6 +76,7 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
public function formatProvider()
{
$dateTime = new \DateTime('@0');
$dateTimeImmutable = new \DateTimeImmutable('@0');
$formatData = [
/* general */
@ -250,6 +251,12 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
$formatData[] = ['h:mm a', $dateTime, '12:00 AM'];
$formatData[] = ['yyyyy.MMMM.dd hh:mm aaa', $dateTime, '01970.January.01 12:00 AM'];
/* general, DateTimeImmutable */
$formatData[] = ['y-M-d', $dateTimeImmutable, '1970-1-1'];
$formatData[] = ["EEE, MMM d, ''yy", $dateTimeImmutable, "Thu, Jan 1, '70"];
$formatData[] = ['h:mm a', $dateTimeImmutable, '12:00 AM'];
$formatData[] = ['yyyyy.MMMM.dd hh:mm aaa', $dateTimeImmutable, '01970.January.01 12:00 AM'];
if (IcuVersion::compare(Intl::getIcuVersion(), '59.1', '>=', 1)) {
// Before ICU 59.1 GMT was used instead of UTC
$formatData[] = ["yyyy.MM.dd 'at' HH:mm:ss zzz", 0, '1970.01.01 at 00:00:00 UTC'];
@ -269,6 +276,8 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
$this->assertSame('1970.01.01 at 00:00:00 GMT', $gmtFormatter->format(new \DateTime('@0')));
$this->assertSame('1970.01.01 at 00:00:00 UTC', $utcFormatter->format(new \DateTime('@0')));
$this->assertSame('1970.01.01 at 00:00:00 GMT', $gmtFormatter->format(new \DateTimeImmutable('@0')));
$this->assertSame('1970.01.01 at 00:00:00 UTC', $utcFormatter->format(new \DateTimeImmutable('@0')));
}
/**

View File

@ -73,7 +73,7 @@ class IntlTest extends TestCase
public function testGetDataDirectoryReturnsThePathToIcuData()
{
$this->assertTrue(is_dir(Intl::getDataDirectory()));
$this->assertDirectoryExists(Intl::getDataDirectory());
}
/**

View File

@ -644,11 +644,9 @@ class LanguagesTest extends ResourceBundleTestCase
'ab' => 'abk',
'af' => 'afr',
'ak' => 'aka',
'sq' => 'sqi',
'am' => 'amh',
'ar' => 'ara',
'an' => 'arg',
'hy' => 'hye',
'as' => 'asm',
'av' => 'ava',
'ae' => 'ave',
@ -656,7 +654,6 @@ class LanguagesTest extends ResourceBundleTestCase
'az' => 'aze',
'ba' => 'bak',
'bm' => 'bam',
'eu' => 'eus',
'be' => 'bel',
'bn' => 'ben',
'bi' => 'bis',
@ -664,12 +661,10 @@ class LanguagesTest extends ResourceBundleTestCase
'bs' => 'bos',
'br' => 'bre',
'bg' => 'bul',
'my' => 'mya',
'ca' => 'cat',
'cs' => 'ces',
'ch' => 'cha',
'ce' => 'che',
'zh' => 'zho',
'cu' => 'chu',
'cv' => 'chv',
'kw' => 'cor',
@ -679,13 +674,12 @@ class LanguagesTest extends ResourceBundleTestCase
'da' => 'dan',
'de' => 'deu',
'dv' => 'div',
'nl' => 'nld',
'dz' => 'dzo',
'et' => 'est',
'el' => 'ell',
'en' => 'eng',
'eo' => 'epo',
'ik' => 'ipk',
'et' => 'est',
'eu' => 'eus',
'ee' => 'ewe',
'fo' => 'fao',
'fa' => 'fas',
@ -694,8 +688,6 @@ class LanguagesTest extends ResourceBundleTestCase
'fr' => 'fra',
'fy' => 'fry',
'ff' => 'ful',
'om' => 'orm',
'ka' => 'kat',
'gd' => 'gla',
'ga' => 'gle',
'gl' => 'glg',
@ -710,32 +702,34 @@ class LanguagesTest extends ResourceBundleTestCase
'ho' => 'hmo',
'hr' => 'hrv',
'hu' => 'hun',
'hy' => 'hye',
'ig' => 'ibo',
'is' => 'isl',
'io' => 'ido',
'ii' => 'iii',
'iu' => 'iku',
'ie' => 'ile',
'ia' => 'ina',
'id' => 'ind',
'ik' => 'ipk',
'is' => 'isl',
'it' => 'ita',
'jv' => 'jav',
'ja' => 'jpn',
'kl' => 'kal',
'kn' => 'kan',
'ks' => 'kas',
'ka' => 'kat',
'kr' => 'kau',
'kk' => 'kaz',
'mn' => 'mon',
'km' => 'khm',
'ki' => 'kik',
'rw' => 'kin',
'ky' => 'kir',
'ku' => 'kur',
'kg' => 'kon',
'kv' => 'kom',
'kg' => 'kon',
'ko' => 'kor',
'kj' => 'kua',
'ku' => 'kur',
'lo' => 'lao',
'la' => 'lat',
'lv' => 'lav',
@ -745,32 +739,36 @@ class LanguagesTest extends ResourceBundleTestCase
'lb' => 'ltz',
'lu' => 'lub',
'lg' => 'lug',
'mk' => 'mkd',
'mh' => 'mah',
'ml' => 'mal',
'mi' => 'mri',
'mr' => 'mar',
'ms' => 'msa',
'mk' => 'mkd',
'mg' => 'mlg',
'mt' => 'mlt',
'mn' => 'mon',
'mi' => 'mri',
'ms' => 'msa',
'my' => 'mya',
'na' => 'nau',
'nv' => 'nav',
'nr' => 'nbl',
'nd' => 'nde',
'ng' => 'ndo',
'ne' => 'nep',
'nl' => 'nld',
'nn' => 'nno',
'nb' => 'nob',
'ny' => 'nya',
'oc' => 'oci',
'oj' => 'oji',
'or' => 'ori',
'om' => 'orm',
'os' => 'oss',
'pa' => 'pan',
'ps' => 'pus',
'pi' => 'pli',
'pl' => 'pol',
'pt' => 'por',
'ps' => 'pus',
'qu' => 'que',
'rm' => 'roh',
'ro' => 'ron',
@ -778,7 +776,6 @@ class LanguagesTest extends ResourceBundleTestCase
'ru' => 'rus',
'sg' => 'sag',
'sa' => 'san',
'sr' => 'srp',
'si' => 'sin',
'sk' => 'slk',
'sl' => 'slv',
@ -789,7 +786,9 @@ class LanguagesTest extends ResourceBundleTestCase
'so' => 'som',
'st' => 'sot',
'es' => 'spa',
'sq' => 'sqi',
'sc' => 'srd',
'sr' => 'srp',
'ss' => 'ssw',
'su' => 'sun',
'sw' => 'swa',
@ -819,6 +818,7 @@ class LanguagesTest extends ResourceBundleTestCase
'yi' => 'yid',
'yo' => 'yor',
'za' => 'zha',
'zh' => 'zho',
'zu' => 'zul',
];

View File

@ -11,6 +11,7 @@
namespace Symfony\Component\Intl\Tests\NumberFormatter;
use PHPUnit\Framework\Error\Warning;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Intl\Globals\IntlGlobals;
use Symfony\Component\Intl\NumberFormatter\NumberFormatter;
@ -323,13 +324,7 @@ abstract class AbstractNumberFormatterTest extends TestCase
*/
public function testFormatTypeCurrency($formatter, $value)
{
$exceptionCode = 'PHPUnit\Framework\Error\Warning';
if (class_exists('PHPUnit_Framework_Error_Warning')) {
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
}
$this->expectException($exceptionCode);
$this->expectException(Warning::class);
$formatter->format($value, NumberFormatter::TYPE_CURRENCY);
}
@ -706,13 +701,7 @@ abstract class AbstractNumberFormatterTest extends TestCase
public function testParseTypeDefault()
{
$exceptionCode = 'PHPUnit\Framework\Error\Warning';
if (class_exists('PHPUnit_Framework_Error_Warning')) {
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
}
$this->expectException($exceptionCode);
$this->expectException(Warning::class);
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->parse('1', NumberFormatter::TYPE_DEFAULT);
@ -832,13 +821,7 @@ abstract class AbstractNumberFormatterTest extends TestCase
public function testParseTypeCurrency()
{
$exceptionCode = 'PHPUnit\Framework\Error\Warning';
if (class_exists('PHPUnit_Framework_Error_Warning')) {
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
}
$this->expectException($exceptionCode);
$this->expectException(Warning::class);
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->parse('1', NumberFormatter::TYPE_CURRENCY);

View File

@ -51,7 +51,7 @@ class GitRepositoryTest extends TestCase
$git = GitRepository::download(self::REPO_URL, $this->targetDir);
$this->assertInstanceOf(GitRepository::class, $git);
$this->assertTrue(is_dir($this->targetDir.'/.git'));
$this->assertDirectoryExists($this->targetDir.'/.git');
$this->assertSame($this->targetDir, $git->getPath());
$this->assertSame(self::REPO_URL, $git->getUrl());
$this->assertRegExp('#^[0-9a-z]{40}$#', $git->getLastCommitHash());

View File

@ -26,11 +26,10 @@ use Symfony\Component\Ldap\Security\LdapUserProvider;
*/
class LdapUserProviderTest extends TestCase
{
/**
* @expectedException \Symfony\Component\Security\Core\Exception\UsernameNotFoundException
*/
public function testLoadUserByUsernameFailsIfCantConnectToLdap()
{
$this->expectException(\Symfony\Component\Security\Core\Exception\UsernameNotFoundException::class);
$ldap = $this->createMock(LdapInterface::class);
$ldap
->expects($this->once())
@ -42,11 +41,10 @@ class LdapUserProviderTest extends TestCase
$provider->loadUserByUsername('foo');
}
/**
* @expectedException \Symfony\Component\Security\Core\Exception\UsernameNotFoundException
*/
public function testLoadUserByUsernameFailsIfNoLdapEntries()
{
$this->expectException(\Symfony\Component\Security\Core\Exception\UsernameNotFoundException::class);
$result = $this->createMock(CollectionInterface::class);
$query = $this->createMock(QueryInterface::class);
$query
@ -75,11 +73,10 @@ class LdapUserProviderTest extends TestCase
$provider->loadUserByUsername('foo');
}
/**
* @expectedException \Symfony\Component\Security\Core\Exception\UsernameNotFoundException
*/
public function testLoadUserByUsernameFailsIfMoreThanOneLdapEntry()
{
$this->expectException(\Symfony\Component\Security\Core\Exception\UsernameNotFoundException::class);
$result = $this->createMock(CollectionInterface::class);
$query = $this->createMock(QueryInterface::class);
$query
@ -108,11 +105,10 @@ class LdapUserProviderTest extends TestCase
$provider->loadUserByUsername('foo');
}
/**
* @expectedException \Symfony\Component\Security\Core\Exception\InvalidArgumentException
*/
public function testLoadUserByUsernameFailsIfMoreThanOneLdapPasswordsInEntry()
{
$this->expectException(\Symfony\Component\Security\Core\Exception\InvalidArgumentException::class);
$result = $this->createMock(CollectionInterface::class);
$query = $this->createMock(QueryInterface::class);
$query
@ -186,11 +182,10 @@ class LdapUserProviderTest extends TestCase
$this->assertInstanceOf(LdapUser::class, $provider->loadUserByUsername('foo'));
}
/**
* @expectedException \Symfony\Component\Security\Core\Exception\InvalidArgumentException
*/
public function testLoadUserByUsernameFailsIfEntryHasNoPasswordAttribute()
{
$this->expectException(\Symfony\Component\Security\Core\Exception\InvalidArgumentException::class);
$result = $this->createMock(CollectionInterface::class);
$query = $this->createMock(QueryInterface::class);
$query

View File

@ -94,7 +94,7 @@ class ConsumeMessagesCommand extends Command
new InputOption('memory-limit', 'm', InputOption::VALUE_REQUIRED, 'The memory limit the worker can consume'),
new InputOption('time-limit', 't', InputOption::VALUE_REQUIRED, 'The time limit in seconds the worker can run'),
new InputOption('sleep', null, InputOption::VALUE_REQUIRED, 'Seconds to sleep before asking for new messages after no messages were found', 1),
new InputOption('bus', 'b', InputOption::VALUE_REQUIRED, 'Name of the bus to which received messages should be dispatched (if not passed, bus is determined automatically.'),
new InputOption('bus', 'b', InputOption::VALUE_REQUIRED, 'Name of the bus to which received messages should be dispatched (if not passed, bus is determined automatically)'),
])
->setDescription('Consumes messages')
->setHelp(<<<'EOF'

View File

@ -91,6 +91,8 @@ abstract class AbstractCloner implements ClonerInterface
'ProxyManager\Proxy\ProxyInterface' => ['Symfony\Component\VarDumper\Caster\ProxyManagerCaster', 'castProxy'],
'PHPUnit_Framework_MockObject_MockObject' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'PHPUnit\Framework\MockObject\MockObject' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'PHPUnit\Framework\MockObject\Stub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'Prophecy\Prophecy\ProphecySubjectInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'Mockery\MockInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],

View File

@ -580,7 +580,7 @@ abstract class HttpClientTestCase extends TestCase
$response = null;
$this->expectException(TransportExceptionInterface::class);
$client->request('GET', 'http://symfony.com:8057/', ['timeout' => 3]);
$client->request('GET', 'http://symfony.com:8057/', ['timeout' => 1]);
}
public function testTimeoutOnAccess()
@ -643,7 +643,6 @@ abstract class HttpClientTestCase extends TestCase
{
$client = $this->getHttpClient(__FUNCTION__);
$downloaded = 0;
$start = microtime(true);
$client->request('GET', 'http://localhost:8057/timeout-long');
$client = null;