Merge branch '3.4' into 4.3
* 3.4: Adopt `@PHPUnit55Migration:risky` rule of php-cs-fixer
This commit is contained in:
commit
07bade03e4
|
@ -8,8 +8,9 @@ return PhpCsFixer\Config::create()
|
|||
->setRules([
|
||||
'@Symfony' => true,
|
||||
'@Symfony:risky' => true,
|
||||
'@PHPUnit48Migration:risky' => true,
|
||||
'php_unit_no_expectation_annotation' => false, // part of `PHPUnitXYMigration:risky` ruleset, to be enabled when PHPUnit 4.x support will be dropped, as we don't want to rewrite exceptions handling twice
|
||||
'@PHPUnit75Migration:risky' => true,
|
||||
'php_unit_dedicate_assert' => ['target' => '3.5'],
|
||||
'phpdoc_no_empty_return' => false, // triggers almost always false positive
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'fopen_flags' => false,
|
||||
'ordered_imports' => true,
|
||||
|
|
|
@ -165,7 +165,7 @@ class ConsoleLoggerTest extends TestCase
|
|||
if (method_exists($this, 'createPartialMock')) {
|
||||
$dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']);
|
||||
} else {
|
||||
$dummy = $this->getMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']);
|
||||
$dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']);
|
||||
}
|
||||
$dummy->method('__toString')->willReturn('DUMMY');
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
namespace Symfony\Component\Debug\Tests\Exception;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
|
||||
use Symfony\Component\Debug\Exception\FatalThrowableError;
|
||||
use Symfony\Component\Debug\Exception\FlattenException;
|
||||
use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
|
||||
|
@ -32,6 +33,8 @@ use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException;
|
|||
|
||||
class FlattenExceptionTest extends TestCase
|
||||
{
|
||||
use ForwardCompatTestTrait;
|
||||
|
||||
public function testStatusCode()
|
||||
{
|
||||
$flattened = FlattenException::create(new \RuntimeException(), 403);
|
||||
|
@ -294,7 +297,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()
|
||||
|
|
|
@ -912,8 +912,8 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
* This methods allows for simple registration of service definition
|
||||
* with a fluid interface.
|
||||
*
|
||||
* @param string $id The service identifier
|
||||
* @param string $class|null The service class
|
||||
* @param string $id The service identifier
|
||||
* @param string|null $class The service class
|
||||
*
|
||||
* @return Definition A Definition instance
|
||||
*/
|
||||
|
|
|
@ -55,15 +55,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 (\PHPUnit\Framework\MockObject\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 (\PHPUnit\Framework\MockObject\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 (\PHPUnit\Framework\MockObject\MockObject $container) {
|
||||
$container->expects($this->exactly(2))->method('hasParameter')->willReturn(true);
|
||||
$container->expects($this->exactly(2))->method('getParameter')
|
||||
->withConsecutive(
|
||||
|
|
|
@ -13,7 +13,6 @@ namespace Symfony\Component\DependencyInjection\Tests;
|
|||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
|
||||
use Symfony\Component\DependencyInjection\Alias;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
|
||||
|
|
|
@ -509,6 +509,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @dataProvider nanRepresentationProvider
|
||||
*
|
||||
* @see https://github.com/symfony/symfony/issues/3161
|
||||
*/
|
||||
public function testReverseTransformDisallowsNaN($nan)
|
||||
|
|
|
@ -28,7 +28,6 @@ class ButtonTypeTest extends BaseTypeTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $emptyData
|
||||
* @param null $expectedData
|
||||
*/
|
||||
|
|
|
@ -20,11 +20,7 @@ class TranslationFilesTest extends TestCase
|
|||
*/
|
||||
public function testTranslationFileIsValid($filePath)
|
||||
{
|
||||
if (class_exists('PHPUnit_Util_XML')) {
|
||||
\PHPUnit_Util_XML::loadfile($filePath, false, false, true);
|
||||
} else {
|
||||
\PHPUnit\Util\XML::loadfile($filePath, false, false, true);
|
||||
}
|
||||
\PHPUnit\Util\XML::loadfile($filePath, false, false, true);
|
||||
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ class LoggerTest extends TestCase
|
|||
if (method_exists($this, 'createPartialMock')) {
|
||||
$dummy = $this->createPartialMock(DummyTest::class, ['__toString']);
|
||||
} else {
|
||||
$dummy = $this->getMock(DummyTest::class, ['__toString']);
|
||||
$dummy = $this->createPartialMock(DummyTest::class, ['__toString']);
|
||||
}
|
||||
$dummy->expects($this->atLeastOnce())
|
||||
->method('__toString')
|
||||
|
|
|
@ -92,8 +92,8 @@ class TimezoneTransformer extends Transformer
|
|||
*
|
||||
* @return string A timezone identifier
|
||||
*
|
||||
* @see http://php.net/manual/en/timezones.others.php
|
||||
* @see http://www.twinsun.com/tz/tz-link.htm
|
||||
* @see http://php.net/manual/en/timezones.others.php
|
||||
* @see http://www.twinsun.com/tz/tz-link.htm
|
||||
*
|
||||
* @throws NotImplementedException When the GMT time zone have minutes offset different than zero
|
||||
* @throws \InvalidArgumentException When the value can not be matched with pattern
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
namespace Symfony\Component\Lock\Tests\Store;
|
||||
|
||||
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
|
||||
use Symfony\Component\Lock\Exception\LockExpiredException;
|
||||
use Symfony\Component\Lock\Key;
|
||||
use Symfony\Component\Lock\StoreInterface;
|
||||
|
|
|
@ -20,11 +20,7 @@ class TranslationFilesTest extends TestCase
|
|||
*/
|
||||
public function testTranslationFileIsValid($filePath)
|
||||
{
|
||||
if (class_exists('PHPUnit_Util_XML')) {
|
||||
\PHPUnit_Util_XML::loadfile($filePath, false, false, true);
|
||||
} else {
|
||||
\PHPUnit\Util\XML::loadfile($filePath, false, false, true);
|
||||
}
|
||||
\PHPUnit\Util\XML::loadfile($filePath, false, false, true);
|
||||
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ class GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest extends Greate
|
|||
{
|
||||
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
|
||||
$this->expectExceptionMessage('The "propertyPath" option of the "Symfony\Component\Validator\Constraints\PositiveOrZero" constraint cannot be set.');
|
||||
|
||||
return new PositiveOrZero(['propertyPath' => 'field']);
|
||||
}
|
||||
|
||||
|
@ -62,6 +63,7 @@ class GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest extends Greate
|
|||
{
|
||||
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
|
||||
$this->expectExceptionMessage('The "value" option of the "Symfony\Component\Validator\Constraints\PositiveOrZero" constraint cannot be set.');
|
||||
|
||||
return new PositiveOrZero(['value' => 0]);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ class GreaterThanValidatorWithPositiveConstraintTest extends GreaterThanValidato
|
|||
{
|
||||
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
|
||||
$this->expectExceptionMessage('The "propertyPath" option of the "Symfony\Component\Validator\Constraints\Positive" constraint cannot be set.');
|
||||
|
||||
return new Positive(['propertyPath' => 'field']);
|
||||
}
|
||||
|
||||
|
@ -60,6 +61,7 @@ class GreaterThanValidatorWithPositiveConstraintTest extends GreaterThanValidato
|
|||
{
|
||||
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
|
||||
$this->expectExceptionMessage('The "value" option of the "Symfony\Component\Validator\Constraints\Positive" constraint cannot be set.');
|
||||
|
||||
return new Positive(['value' => 0]);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ class LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest extends LessThanO
|
|||
{
|
||||
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
|
||||
$this->expectExceptionMessage('The "propertyPath" option of the "Symfony\Component\Validator\Constraints\NegativeOrZero" constraint cannot be set.');
|
||||
|
||||
return new NegativeOrZero(['propertyPath' => 'field']);
|
||||
}
|
||||
|
||||
|
@ -60,6 +61,7 @@ class LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest extends LessThanO
|
|||
{
|
||||
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
|
||||
$this->expectExceptionMessage('The "value" option of the "Symfony\Component\Validator\Constraints\NegativeOrZero" constraint cannot be set.');
|
||||
|
||||
return new NegativeOrZero(['value' => 0]);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ class LessThanValidatorWithNegativeConstraintTest extends LessThanValidatorTest
|
|||
{
|
||||
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
|
||||
$this->expectExceptionMessage('The "propertyPath" option of the "Symfony\Component\Validator\Constraints\Negative" constraint cannot be set.');
|
||||
|
||||
return new Negative(['propertyPath' => 'field']);
|
||||
}
|
||||
|
||||
|
@ -60,6 +61,7 @@ class LessThanValidatorWithNegativeConstraintTest extends LessThanValidatorTest
|
|||
{
|
||||
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
|
||||
$this->expectExceptionMessage('The "value" option of the "Symfony\Component\Validator\Constraints\Negative" constraint cannot be set.');
|
||||
|
||||
return new Negative(['value' => 0]);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,11 +20,7 @@ class TranslationFilesTest extends TestCase
|
|||
*/
|
||||
public function testTranslationFileIsValid($filePath)
|
||||
{
|
||||
if (class_exists('PHPUnit_Util_XML')) {
|
||||
\PHPUnit_Util_XML::loadfile($filePath, false, false, true);
|
||||
} else {
|
||||
\PHPUnit\Util\XML::loadfile($filePath, false, false, true);
|
||||
}
|
||||
\PHPUnit\Util\XML::loadfile($filePath, false, false, true);
|
||||
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
|
|
@ -656,7 +656,6 @@ class InlineTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @dataProvider getNotPhpCompatibleMappingKeyData
|
||||
*/
|
||||
public function testImplicitStringCastingOfMappingKeysIsDeprecated($yaml, $expected)
|
||||
|
|
|
@ -13,7 +13,6 @@ namespace Symfony\Component\Yaml\Tests;
|
|||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
|
||||
use Symfony\Component\Yaml\Exception\ParseException;
|
||||
use Symfony\Component\Yaml\Parser;
|
||||
use Symfony\Component\Yaml\Tag\TaggedValue;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
@ -786,7 +785,6 @@ EOF
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* > It is an error for two equal keys to appear in the same mapping node.
|
||||
* > In such a case the YAML processor may continue, ignoring the second
|
||||
* > "key: value" pair and issuing an appropriate warning. This strategy
|
||||
|
|
Reference in New Issue