Merge branch '3.4' into 4.3
* 3.4: Fix inconsistent return points. Fix remaining tests
This commit is contained in:
commit
381c995d30
@ -113,5 +113,7 @@ class Logger extends BaseLogger implements DebugLoggerInterface, ResetInterface
|
|||||||
return $handler;
|
return $handler;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
->canBeEnabled()
|
->canBeEnabled()
|
||||||
->beforeNormalization()
|
->beforeNormalization()
|
||||||
->always(function ($v) {
|
->always(function ($v) {
|
||||||
if (true === $v['enabled']) {
|
if (\is_array($v) && true === $v['enabled']) {
|
||||||
$workflows = $v;
|
$workflows = $v;
|
||||||
unset($workflows['enabled']);
|
unset($workflows['enabled']);
|
||||||
|
|
||||||
|
@ -54,14 +54,14 @@ class FirewallMap implements FirewallMapInterface
|
|||||||
$context = $this->getFirewallContext($request);
|
$context = $this->getFirewallContext($request);
|
||||||
|
|
||||||
if (null === $context) {
|
if (null === $context) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $context->getConfig();
|
return $context->getConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return FirewallContext
|
* @return FirewallContext|null
|
||||||
*/
|
*/
|
||||||
private function getFirewallContext(Request $request)
|
private function getFirewallContext(Request $request)
|
||||||
{
|
{
|
||||||
@ -83,5 +83,7 @@ class FirewallMap implements FirewallMapInterface
|
|||||||
return $this->container->get($contextId);
|
return $this->container->get($contextId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ class XmlUtils
|
|||||||
return true;
|
return true;
|
||||||
case 'false' === $lowercaseValue:
|
case 'false' === $lowercaseValue:
|
||||||
return false;
|
return false;
|
||||||
case isset($value[1]) && '0b' == $value[0].$value[1]:
|
case isset($value[1]) && '0b' == $value[0].$value[1] && preg_match('/^0b[01]*$/', $value):
|
||||||
return bindec($value);
|
return bindec($value);
|
||||||
case is_numeric($value):
|
case is_numeric($value):
|
||||||
return '0x' === $value[0].$value[1] ? hexdec($value) : (float) $value;
|
return '0x' === $value[0].$value[1] ? hexdec($value) : (float) $value;
|
||||||
|
@ -87,25 +87,13 @@ class Terminal
|
|||||||
*/
|
*/
|
||||||
private static function getConsoleMode()
|
private static function getConsoleMode()
|
||||||
{
|
{
|
||||||
if (!\function_exists('proc_open')) {
|
$info = self::readFromProcess('mode CON');
|
||||||
return;
|
|
||||||
|
if (null === $info || !preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$descriptorspec = [
|
return [(int) $matches[2], (int) $matches[1]];
|
||||||
1 => ['pipe', 'w'],
|
|
||||||
2 => ['pipe', 'w'],
|
|
||||||
];
|
|
||||||
$process = proc_open('mode CON', $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
|
|
||||||
if (\is_resource($process)) {
|
|
||||||
$info = stream_get_contents($pipes[1]);
|
|
||||||
fclose($pipes[1]);
|
|
||||||
fclose($pipes[2]);
|
|
||||||
proc_close($process);
|
|
||||||
|
|
||||||
if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
|
|
||||||
return [(int) $matches[2], (int) $matches[1]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -114,9 +102,19 @@ class Terminal
|
|||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
private static function getSttyColumns()
|
private static function getSttyColumns()
|
||||||
|
{
|
||||||
|
return self::readFromProcess('stty -a | grep columns');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $command
|
||||||
|
*
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
private static function readFromProcess($command)
|
||||||
{
|
{
|
||||||
if (!\function_exists('proc_open')) {
|
if (!\function_exists('proc_open')) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$descriptorspec = [
|
$descriptorspec = [
|
||||||
@ -124,14 +122,16 @@ class Terminal
|
|||||||
2 => ['pipe', 'w'],
|
2 => ['pipe', 'w'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
|
$process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
|
||||||
if (\is_resource($process)) {
|
if (!\is_resource($process)) {
|
||||||
$info = stream_get_contents($pipes[1]);
|
return null;
|
||||||
fclose($pipes[1]);
|
|
||||||
fclose($pipes[2]);
|
|
||||||
proc_close($process);
|
|
||||||
|
|
||||||
return $info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$info = stream_get_contents($pipes[1]);
|
||||||
|
fclose($pipes[1]);
|
||||||
|
fclose($pipes[2]);
|
||||||
|
proc_close($process);
|
||||||
|
|
||||||
|
return $info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -459,7 +459,7 @@ class ErrorHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($throw) {
|
if ($throw) {
|
||||||
if (E_USER_ERROR & $type) {
|
if (\PHP_VERSION_ID < 70400 && E_USER_ERROR & $type) {
|
||||||
for ($i = 1; isset($backtrace[$i]); ++$i) {
|
for ($i = 1; isset($backtrace[$i]); ++$i) {
|
||||||
if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
|
if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
|
||||||
&& '__toString' === $backtrace[$i]['function']
|
&& '__toString' === $backtrace[$i]['function']
|
||||||
|
@ -283,6 +283,10 @@ class ErrorHandlerTest extends TestCase
|
|||||||
|
|
||||||
public function testHandleUserError()
|
public function testHandleUserError()
|
||||||
{
|
{
|
||||||
|
if (\PHP_VERSION_ID >= 70400) {
|
||||||
|
$this->markTestSkipped('PHP 7.4 allows __toString to throw exceptions');
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$handler = ErrorHandler::register();
|
$handler = ErrorHandler::register();
|
||||||
$handler->throwAt(0, true);
|
$handler->throwAt(0, true);
|
||||||
|
@ -309,6 +309,8 @@ class AutowirePass extends AbstractRecursivePass
|
|||||||
if ($this->container->has($type) && !$this->container->findDefinition($type)->isAbstract()) {
|
if ($this->container->has($type) && !$this->container->findDefinition($type)->isAbstract()) {
|
||||||
return new TypedReference($type, $type, $reference->getInvalidBehavior());
|
return new TypedReference($type, $type, $reference->getInvalidBehavior());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -441,7 +443,7 @@ class AutowirePass extends AbstractRecursivePass
|
|||||||
} elseif (isset($this->types[$type])) {
|
} elseif (isset($this->types[$type])) {
|
||||||
$message = sprintf('the existing "%s" service', $this->types[$type]);
|
$message = sprintf('the existing "%s" service', $this->types[$type]);
|
||||||
} else {
|
} else {
|
||||||
return;
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf(' You should maybe alias this %s to %s.', class_exists($type, false) ? 'class' : 'interface', $message);
|
return sprintf(' You should maybe alias this %s to %s.', class_exists($type, false) ? 'class' : 'interface', $message);
|
||||||
@ -470,5 +472,7 @@ class AutowirePass extends AbstractRecursivePass
|
|||||||
if ($aliases) {
|
if ($aliases) {
|
||||||
return sprintf('Try changing the type-hint%s to "%s" instead.', $extraContext, $aliases[0]);
|
return sprintf('Try changing the type-hint%s to "%s" instead.', $extraContext, $aliases[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ class XmlFileLoader extends FileLoader
|
|||||||
$alias->setDeprecated(true, $deprecated[0]->nodeValue ?: null);
|
$alias->setDeprecated(true, $deprecated[0]->nodeValue ?: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isLoadingInstanceof) {
|
if ($this->isLoadingInstanceof) {
|
||||||
|
@ -57,7 +57,7 @@ class FormFieldRegistry
|
|||||||
$target = &$this->fields;
|
$target = &$this->fields;
|
||||||
while (\count($segments) > 1) {
|
while (\count($segments) > 1) {
|
||||||
$path = array_shift($segments);
|
$path = array_shift($segments);
|
||||||
if (!\array_key_exists($path, $target)) {
|
if (!\is_array($target) || !\array_key_exists($path, $target)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$target = &$target[$path];
|
$target = &$target[$path];
|
||||||
@ -80,7 +80,7 @@ class FormFieldRegistry
|
|||||||
$target = &$this->fields;
|
$target = &$this->fields;
|
||||||
while ($segments) {
|
while ($segments) {
|
||||||
$path = array_shift($segments);
|
$path = array_shift($segments);
|
||||||
if (!\array_key_exists($path, $target)) {
|
if (!\is_array($target) || !\array_key_exists($path, $target)) {
|
||||||
throw new \InvalidArgumentException(sprintf('Unreachable field "%s"', $path));
|
throw new \InvalidArgumentException(sprintf('Unreachable field "%s"', $path));
|
||||||
}
|
}
|
||||||
$target = &$target[$path];
|
$target = &$target[$path];
|
||||||
|
@ -33,11 +33,7 @@ class SortableIteratorTest extends RealIteratorTestCase
|
|||||||
if (!\is_callable($mode)) {
|
if (!\is_callable($mode)) {
|
||||||
switch ($mode) {
|
switch ($mode) {
|
||||||
case SortableIterator::SORT_BY_ACCESSED_TIME:
|
case SortableIterator::SORT_BY_ACCESSED_TIME:
|
||||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
touch(self::toAbsolute('.git'));
|
||||||
touch(self::toAbsolute('.git'));
|
|
||||||
} else {
|
|
||||||
file_get_contents(self::toAbsolute('.git'));
|
|
||||||
}
|
|
||||||
sleep(1);
|
sleep(1);
|
||||||
file_get_contents(self::toAbsolute('.bar'));
|
file_get_contents(self::toAbsolute('.bar'));
|
||||||
break;
|
break;
|
||||||
|
@ -507,6 +507,7 @@ class DateTypeTest extends BaseTypeTest
|
|||||||
|
|
||||||
public function testMonthsOption()
|
public function testMonthsOption()
|
||||||
{
|
{
|
||||||
|
\Locale::setDefault('en');
|
||||||
$form = $this->factory->create(static::TESTED_TYPE, null, [
|
$form = $this->factory->create(static::TESTED_TYPE, null, [
|
||||||
'months' => [6, 7],
|
'months' => [6, 7],
|
||||||
'format' => \IntlDateFormatter::SHORT,
|
'format' => \IntlDateFormatter::SHORT,
|
||||||
@ -515,8 +516,8 @@ class DateTypeTest extends BaseTypeTest
|
|||||||
$view = $form->createView();
|
$view = $form->createView();
|
||||||
|
|
||||||
$this->assertEquals([
|
$this->assertEquals([
|
||||||
new ChoiceView(6, '6', '06'),
|
new ChoiceView(6, '6', '6'),
|
||||||
new ChoiceView(7, '7', '07'),
|
new ChoiceView(7, '7', '7'),
|
||||||
], $view['month']->vars['choices']);
|
], $view['month']->vars['choices']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -580,14 +581,15 @@ class DateTypeTest extends BaseTypeTest
|
|||||||
|
|
||||||
public function testIsDayWithinRangeReturnsTrueIfWithin()
|
public function testIsDayWithinRangeReturnsTrueIfWithin()
|
||||||
{
|
{
|
||||||
|
\Locale::setDefault('en');
|
||||||
$view = $this->factory->create(static::TESTED_TYPE, null, [
|
$view = $this->factory->create(static::TESTED_TYPE, null, [
|
||||||
'days' => [6, 7],
|
'days' => [6, 7],
|
||||||
])
|
])
|
||||||
->createView();
|
->createView();
|
||||||
|
|
||||||
$this->assertEquals([
|
$this->assertEquals([
|
||||||
new ChoiceView(6, '6', '06'),
|
new ChoiceView(6, '6', '6'),
|
||||||
new ChoiceView(7, '7', '07'),
|
new ChoiceView(7, '7', '7'),
|
||||||
], $view['day']->vars['choices']);
|
], $view['day']->vars['choices']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ class Store implements StoreInterface
|
|||||||
$key = $this->getCacheKey($request);
|
$key = $this->getCacheKey($request);
|
||||||
|
|
||||||
if (!$entries = $this->getMetadata($key)) {
|
if (!$entries = $this->getMetadata($key)) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// find a cached entry that matches the request.
|
// find a cached entry that matches the request.
|
||||||
@ -146,7 +146,7 @@ class Store implements StoreInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (null === $match) {
|
if (null === $match) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = $match[1];
|
$headers = $match[1];
|
||||||
@ -157,6 +157,7 @@ class Store implements StoreInterface
|
|||||||
// TODO the metaStore referenced an entity that doesn't exist in
|
// TODO the metaStore referenced an entity that doesn't exist in
|
||||||
// the entityStore. We definitely want to return nil but we should
|
// the entityStore. We definitely want to return nil but we should
|
||||||
// also purge the entry from the meta-store when this is detected.
|
// also purge the entry from the meta-store when this is detected.
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -178,7 +179,7 @@ class Store implements StoreInterface
|
|||||||
if (!$response->headers->has('X-Content-Digest')) {
|
if (!$response->headers->has('X-Content-Digest')) {
|
||||||
$digest = $this->generateContentDigest($response);
|
$digest = $this->generateContentDigest($response);
|
||||||
|
|
||||||
if (false === $this->save($digest, $response->getContent())) {
|
if (!$this->save($digest, $response->getContent())) {
|
||||||
throw new \RuntimeException('Unable to store the entity.');
|
throw new \RuntimeException('Unable to store the entity.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +208,7 @@ class Store implements StoreInterface
|
|||||||
|
|
||||||
array_unshift($entries, [$storedEnv, $headers]);
|
array_unshift($entries, [$storedEnv, $headers]);
|
||||||
|
|
||||||
if (false === $this->save($key, serialize($entries))) {
|
if (!$this->save($key, serialize($entries))) {
|
||||||
throw new \RuntimeException('Unable to store the metadata.');
|
throw new \RuntimeException('Unable to store the metadata.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +247,7 @@ class Store implements StoreInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($modified && false === $this->save($key, serialize($entries))) {
|
if ($modified && !$this->save($key, serialize($entries))) {
|
||||||
throw new \RuntimeException('Unable to store the metadata.');
|
throw new \RuntimeException('Unable to store the metadata.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -406,6 +407,8 @@ class Store implements StoreInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
@chmod($path, 0666 & ~umask());
|
@chmod($path, 0666 & ~umask());
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPath($key)
|
public function getPath($key)
|
||||||
|
@ -591,6 +591,7 @@ abstract class AbstractCurrencyDataProviderTest extends AbstractDataProviderTest
|
|||||||
* @var CurrencyDataProvider
|
* @var CurrencyDataProvider
|
||||||
*/
|
*/
|
||||||
protected $dataProvider;
|
protected $dataProvider;
|
||||||
|
private $defaultLocale;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
@ -600,6 +601,15 @@ abstract class AbstractCurrencyDataProviderTest extends AbstractDataProviderTest
|
|||||||
$this->getDataDirectory().'/'.Intl::CURRENCY_DIR,
|
$this->getDataDirectory().'/'.Intl::CURRENCY_DIR,
|
||||||
$this->createEntryReader()
|
$this->createEntryReader()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->defaultLocale = \Locale::getDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
|
||||||
|
\Locale::setDefault($this->defaultLocale);
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected function getDataDirectory();
|
abstract protected function getDataDirectory();
|
||||||
|
@ -830,6 +830,7 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
|
|||||||
* @var LanguageDataProvider
|
* @var LanguageDataProvider
|
||||||
*/
|
*/
|
||||||
protected $dataProvider;
|
protected $dataProvider;
|
||||||
|
private $defaultLocale;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
@ -839,6 +840,15 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
|
|||||||
$this->getDataDirectory().'/'.Intl::LANGUAGE_DIR,
|
$this->getDataDirectory().'/'.Intl::LANGUAGE_DIR,
|
||||||
$this->createEntryReader()
|
$this->createEntryReader()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->defaultLocale = \Locale::getDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
|
||||||
|
\Locale::setDefault($this->defaultLocale);
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected function getDataDirectory();
|
abstract protected function getDataDirectory();
|
||||||
|
@ -25,6 +25,7 @@ abstract class AbstractLocaleDataProviderTest extends AbstractDataProviderTest
|
|||||||
* @var LocaleDataProvider
|
* @var LocaleDataProvider
|
||||||
*/
|
*/
|
||||||
protected $dataProvider;
|
protected $dataProvider;
|
||||||
|
private $defaultLocale;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
@ -34,6 +35,13 @@ abstract class AbstractLocaleDataProviderTest extends AbstractDataProviderTest
|
|||||||
$this->getDataDirectory().'/'.Intl::LOCALE_DIR,
|
$this->getDataDirectory().'/'.Intl::LOCALE_DIR,
|
||||||
$this->createEntryReader()
|
$this->createEntryReader()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->defaultLocale = \Locale::getDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
\Locale::setDefault($this->defaultLocale);
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected function getDataDirectory();
|
abstract protected function getDataDirectory();
|
||||||
|
@ -279,6 +279,7 @@ abstract class AbstractRegionDataProviderTest extends AbstractDataProviderTest
|
|||||||
* @var RegionDataProvider
|
* @var RegionDataProvider
|
||||||
*/
|
*/
|
||||||
protected $dataProvider;
|
protected $dataProvider;
|
||||||
|
private $defaultLocale;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
@ -288,6 +289,15 @@ abstract class AbstractRegionDataProviderTest extends AbstractDataProviderTest
|
|||||||
$this->getDataDirectory().'/'.Intl::REGION_DIR,
|
$this->getDataDirectory().'/'.Intl::REGION_DIR,
|
||||||
$this->createEntryReader()
|
$this->createEntryReader()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->defaultLocale = \Locale::getDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
|
||||||
|
\Locale::setDefault($this->defaultLocale);
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected function getDataDirectory();
|
abstract protected function getDataDirectory();
|
||||||
|
@ -219,6 +219,7 @@ abstract class AbstractScriptDataProviderTest extends AbstractDataProviderTest
|
|||||||
* @var ScriptDataProvider
|
* @var ScriptDataProvider
|
||||||
*/
|
*/
|
||||||
protected $dataProvider;
|
protected $dataProvider;
|
||||||
|
private $defaultLocale;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
@ -228,6 +229,15 @@ abstract class AbstractScriptDataProviderTest extends AbstractDataProviderTest
|
|||||||
$this->getDataDirectory().'/'.Intl::SCRIPT_DIR,
|
$this->getDataDirectory().'/'.Intl::SCRIPT_DIR,
|
||||||
$this->createEntryReader()
|
$this->createEntryReader()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->defaultLocale = \Locale::getDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
|
||||||
|
\Locale::setDefault($this->defaultLocale);
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected function getDataDirectory();
|
abstract protected function getDataDirectory();
|
||||||
|
@ -24,11 +24,23 @@ use Symfony\Component\Intl\Util\IcuVersion;
|
|||||||
*/
|
*/
|
||||||
abstract class AbstractIntlDateFormatterTest extends TestCase
|
abstract class AbstractIntlDateFormatterTest extends TestCase
|
||||||
{
|
{
|
||||||
|
private $defaultLocale;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->defaultLocale = \Locale::getDefault();
|
||||||
\Locale::setDefault('en');
|
\Locale::setDefault('en');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
|
||||||
|
\Locale::setDefault($this->defaultLocale);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When a time zone is not specified, it uses the system default however it returns null in the getter method.
|
* When a time zone is not specified, it uses the system default however it returns null in the getter method.
|
||||||
*
|
*
|
||||||
|
@ -16,6 +16,22 @@ use Symfony\Component\Intl\Intl;
|
|||||||
|
|
||||||
class IntlTest extends TestCase
|
class IntlTest extends TestCase
|
||||||
{
|
{
|
||||||
|
private $defaultLocale;
|
||||||
|
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->defaultLocale = \Locale::getDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
|
||||||
|
\Locale::setDefault($this->defaultLocale);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @requires extension intl
|
* @requires extension intl
|
||||||
*/
|
*/
|
||||||
|
@ -36,7 +36,7 @@ abstract class AbstractNumberFormatterTest extends TestCase
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[100, 'ALL', '100'],
|
[100, 'ALL', '100'],
|
||||||
[100, 'BRL', '100.00'],
|
[100, 'BRL', '100'],
|
||||||
[100, 'CRC', '100'],
|
[100, 'CRC', '100'],
|
||||||
[100, 'JPY', '100'],
|
[100, 'JPY', '100'],
|
||||||
[100, 'CHF', '100'],
|
[100, 'CHF', '100'],
|
||||||
|
@ -762,6 +762,8 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
return [$addMethod, $removeMethod];
|
return [$addMethod, $removeMethod];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -337,7 +337,7 @@ class XmlFileLoader extends FileLoader
|
|||||||
private function parseDefaultsConfig(\DOMElement $element, $path)
|
private function parseDefaultsConfig(\DOMElement $element, $path)
|
||||||
{
|
{
|
||||||
if ($this->isElementValueNull($element)) {
|
if ($this->isElementValueNull($element)) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for existing element nodes in the default element. There can
|
// Check for existing element nodes in the default element. There can
|
||||||
@ -374,7 +374,7 @@ class XmlFileLoader extends FileLoader
|
|||||||
private function parseDefaultNode(\DOMElement $node, $path)
|
private function parseDefaultNode(\DOMElement $node, $path)
|
||||||
{
|
{
|
||||||
if ($this->isElementValueNull($node)) {
|
if ($this->isElementValueNull($node)) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($node->localName) {
|
switch ($node->localName) {
|
||||||
|
@ -250,6 +250,8 @@ class Serializer implements SerializerInterface, ContextAwareNormalizerInterface
|
|||||||
return $normalizer;
|
return $normalizer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -291,6 +293,8 @@ class Serializer implements SerializerInterface, ContextAwareNormalizerInterface
|
|||||||
return $normalizer;
|
return $normalizer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,7 +87,7 @@ class StopwatchTest extends TestCase
|
|||||||
$event = $stopwatch->stop('foo');
|
$event = $stopwatch->stop('foo');
|
||||||
|
|
||||||
$this->assertInstanceOf('Symfony\Component\Stopwatch\StopwatchEvent', $event);
|
$this->assertInstanceOf('Symfony\Component\Stopwatch\StopwatchEvent', $event);
|
||||||
$this->assertEquals(200, $event->getDuration(), '', self::DELTA);
|
$this->assertEqualsWithDelta(200, $event->getDuration(), self::DELTA);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUnknownEvent()
|
public function testUnknownEvent()
|
||||||
|
@ -41,6 +41,10 @@ class CsvFileLoader extends FileLoader
|
|||||||
$file->setCsvControl($this->delimiter, $this->enclosure, $this->escape);
|
$file->setCsvControl($this->delimiter, $this->enclosure, $this->escape);
|
||||||
|
|
||||||
foreach ($file as $data) {
|
foreach ($file as $data) {
|
||||||
|
if (false === $data) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ('#' !== substr($data[0], 0, 1) && isset($data[1]) && 2 === \count($data)) {
|
if ('#' !== substr($data[0], 0, 1) && isset($data[1]) && 2 === \count($data)) {
|
||||||
$messages[$data[0]] = $data[1];
|
$messages[$data[0]] = $data[1];
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,22 @@ use Symfony\Contracts\Translation\Test\TranslatorTest;
|
|||||||
|
|
||||||
class IdentityTranslatorTest extends TranslatorTest
|
class IdentityTranslatorTest extends TranslatorTest
|
||||||
{
|
{
|
||||||
|
private $defaultLocale;
|
||||||
|
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->defaultLocale = \Locale::getDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
|
||||||
|
\Locale::setDefault($this->defaultLocale);
|
||||||
|
}
|
||||||
|
|
||||||
public function getTranslator()
|
public function getTranslator()
|
||||||
{
|
{
|
||||||
return new IdentityTranslator();
|
return new IdentityTranslator();
|
||||||
|
@ -18,6 +18,22 @@ use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
|
|||||||
|
|
||||||
class CountryValidatorTest extends ConstraintValidatorTestCase
|
class CountryValidatorTest extends ConstraintValidatorTestCase
|
||||||
{
|
{
|
||||||
|
private $defaultLocale;
|
||||||
|
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->defaultLocale = \Locale::getDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
|
||||||
|
\Locale::setDefault($this->defaultLocale);
|
||||||
|
}
|
||||||
|
|
||||||
protected function createValidator()
|
protected function createValidator()
|
||||||
{
|
{
|
||||||
return new CountryValidator();
|
return new CountryValidator();
|
||||||
|
@ -18,6 +18,22 @@ use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
|
|||||||
|
|
||||||
class CurrencyValidatorTest extends ConstraintValidatorTestCase
|
class CurrencyValidatorTest extends ConstraintValidatorTestCase
|
||||||
{
|
{
|
||||||
|
private $defaultLocale;
|
||||||
|
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->defaultLocale = \Locale::getDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
|
||||||
|
\Locale::setDefault($this->defaultLocale);
|
||||||
|
}
|
||||||
|
|
||||||
protected function createValidator()
|
protected function createValidator()
|
||||||
{
|
{
|
||||||
return new CurrencyValidator();
|
return new CurrencyValidator();
|
||||||
|
@ -18,6 +18,22 @@ use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
|
|||||||
|
|
||||||
class LanguageValidatorTest extends ConstraintValidatorTestCase
|
class LanguageValidatorTest extends ConstraintValidatorTestCase
|
||||||
{
|
{
|
||||||
|
private $defaultLocale;
|
||||||
|
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->defaultLocale = \Locale::getDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
|
||||||
|
\Locale::setDefault($this->defaultLocale);
|
||||||
|
}
|
||||||
|
|
||||||
protected function createValidator()
|
protected function createValidator()
|
||||||
{
|
{
|
||||||
return new LanguageValidator();
|
return new LanguageValidator();
|
||||||
|
@ -50,7 +50,7 @@ class RangeValidatorTest extends ConstraintValidatorTestCase
|
|||||||
[9.99999, '9.99999'],
|
[9.99999, '9.99999'],
|
||||||
['9.99999', '"9.99999"'],
|
['9.99999', '"9.99999"'],
|
||||||
[5, '5'],
|
[5, '5'],
|
||||||
[1.0, '1.0'],
|
[1.0, '1'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ class RangeValidatorTest extends ConstraintValidatorTestCase
|
|||||||
[20.000001, '20.000001'],
|
[20.000001, '20.000001'],
|
||||||
['20.000001', '"20.000001"'],
|
['20.000001', '"20.000001"'],
|
||||||
[21, '21'],
|
[21, '21'],
|
||||||
[30.0, '30.0'],
|
[30.0, '30'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,6 @@ Exception {
|
|||||||
› }
|
› }
|
||||||
}
|
}
|
||||||
%s%eTests%eCaster%eExceptionCasterTest.php:40 { …}
|
%s%eTests%eCaster%eExceptionCasterTest.php:40 { …}
|
||||||
Symfony\Component\VarDumper\Tests\Caster\ExceptionCasterTest->testDefaultSettings() {}
|
|
||||||
%A
|
%A
|
||||||
EODUMP;
|
EODUMP;
|
||||||
|
|
||||||
@ -71,8 +70,7 @@ EODUMP;
|
|||||||
› return new \Exception(''.$msg);
|
› return new \Exception(''.$msg);
|
||||||
› }
|
› }
|
||||||
}
|
}
|
||||||
%s%eTests%eCaster%eExceptionCasterTest.php:65 { …}
|
%s%eTests%eCaster%eExceptionCasterTest.php:64 { …}
|
||||||
Symfony\Component\VarDumper\Tests\Caster\ExceptionCasterTest->testSeek() {}
|
|
||||||
%A
|
%A
|
||||||
EODUMP;
|
EODUMP;
|
||||||
|
|
||||||
@ -96,8 +94,7 @@ Exception {
|
|||||||
› return new \Exception(''.$msg);
|
› return new \Exception(''.$msg);
|
||||||
› }
|
› }
|
||||||
}
|
}
|
||||||
%s%eTests%eCaster%eExceptionCasterTest.php:84 { …}
|
%s%eTests%eCaster%eExceptionCasterTest.php:82 { …}
|
||||||
Symfony\Component\VarDumper\Tests\Caster\ExceptionCasterTest->testNoArgs() {}
|
|
||||||
%A
|
%A
|
||||||
EODUMP;
|
EODUMP;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user