minor #32885 [PhpUnitBridge] Use PHPUnit75Migration in CS fixer (nicolas-grekas)
This PR was merged into the 3.4 branch.
Discussion
----------
[PhpUnitBridge] Use PHPUnit75Migration in CS fixer
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes (not yet) need #32882, #32886, #32893
| Fixed tickets | #32844
| License | MIT
| Doc PR | NA
Bump php-cs-fixer rule to PHPUnit75Migration:risky which add
- php_unit_dedicate_assert_internal_type
- php_unit_expectation
- php_unit_mock
- php_unit_no_expectation_annotation
which are (or will be) all polyfillyed
- [x] need to polyfill `createPartialMock`
Commits
-------
9fb1c421f3
Adopt `@PHPUnit55Migration:risky` rule of php-cs-fixer
This commit is contained in:
commit
61894106d4
@ -8,8 +8,9 @@ return PhpCsFixer\Config::create()
|
|||||||
->setRules([
|
->setRules([
|
||||||
'@Symfony' => true,
|
'@Symfony' => true,
|
||||||
'@Symfony:risky' => true,
|
'@Symfony:risky' => true,
|
||||||
'@PHPUnit48Migration:risky' => true,
|
'@PHPUnit75Migration: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
|
'php_unit_dedicate_assert' => ['target' => '3.5'],
|
||||||
|
'phpdoc_no_empty_return' => false, // triggers almost always false positive
|
||||||
'array_syntax' => ['syntax' => 'short'],
|
'array_syntax' => ['syntax' => 'short'],
|
||||||
'fopen_flags' => false,
|
'fopen_flags' => false,
|
||||||
'ordered_imports' => true,
|
'ordered_imports' => true,
|
||||||
|
@ -165,7 +165,7 @@ class ConsoleLoggerTest extends TestCase
|
|||||||
if (method_exists($this, 'createPartialMock')) {
|
if (method_exists($this, 'createPartialMock')) {
|
||||||
$dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']);
|
$dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']);
|
||||||
} else {
|
} 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');
|
$dummy->method('__toString')->willReturn('DUMMY');
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
namespace Symfony\Component\Debug\Tests\Exception;
|
namespace Symfony\Component\Debug\Tests\Exception;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
|
||||||
use Symfony\Component\Debug\Exception\FlattenException;
|
use Symfony\Component\Debug\Exception\FlattenException;
|
||||||
use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
|
use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
|
||||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||||
@ -31,6 +32,8 @@ use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException;
|
|||||||
|
|
||||||
class FlattenExceptionTest extends TestCase
|
class FlattenExceptionTest extends TestCase
|
||||||
{
|
{
|
||||||
|
use ForwardCompatTestTrait;
|
||||||
|
|
||||||
public function testStatusCode()
|
public function testStatusCode()
|
||||||
{
|
{
|
||||||
$flattened = FlattenException::create(new \RuntimeException(), 403);
|
$flattened = FlattenException::create(new \RuntimeException(), 403);
|
||||||
@ -256,7 +259,7 @@ class FlattenExceptionTest extends TestCase
|
|||||||
|
|
||||||
// assertEquals() does not like NAN values.
|
// assertEquals() does not like NAN values.
|
||||||
$this->assertEquals($array[$i][0], 'float');
|
$this->assertEquals($array[$i][0], 'float');
|
||||||
$this->assertTrue(is_nan($array[$i++][1]));
|
$this->assertNan($array[$i++][1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRecursionInArguments()
|
public function testRecursionInArguments()
|
||||||
|
@ -946,8 +946,8 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
* This methods allows for simple registration of service definition
|
* This methods allows for simple registration of service definition
|
||||||
* with a fluid interface.
|
* with a fluid interface.
|
||||||
*
|
*
|
||||||
* @param string $id The service identifier
|
* @param string $id The service identifier
|
||||||
* @param string $class|null The service class
|
* @param string|null $class The service class
|
||||||
*
|
*
|
||||||
* @return Definition A Definition instance
|
* @return Definition A Definition instance
|
||||||
*/
|
*/
|
||||||
|
@ -13,7 +13,6 @@ namespace Symfony\Component\DependencyInjection\Tests;
|
|||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
|
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
|
||||||
use Symfony\Component\DependencyInjection\Alias;
|
|
||||||
use Symfony\Component\DependencyInjection\Container;
|
use Symfony\Component\DependencyInjection\Container;
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
|
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
|
||||||
|
@ -509,6 +509,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider nanRepresentationProvider
|
* @dataProvider nanRepresentationProvider
|
||||||
|
*
|
||||||
* @see https://github.com/symfony/symfony/issues/3161
|
* @see https://github.com/symfony/symfony/issues/3161
|
||||||
*/
|
*/
|
||||||
public function testReverseTransformDisallowsNaN($nan)
|
public function testReverseTransformDisallowsNaN($nan)
|
||||||
|
@ -28,7 +28,6 @@ class ButtonTypeTest extends BaseTypeTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param string $emptyData
|
* @param string $emptyData
|
||||||
* @param null $expectedData
|
* @param null $expectedData
|
||||||
*/
|
*/
|
||||||
|
@ -142,7 +142,7 @@ class LoggerTest extends TestCase
|
|||||||
if (method_exists($this, 'createPartialMock')) {
|
if (method_exists($this, 'createPartialMock')) {
|
||||||
$dummy = $this->createPartialMock(DummyTest::class, ['__toString']);
|
$dummy = $this->createPartialMock(DummyTest::class, ['__toString']);
|
||||||
} else {
|
} else {
|
||||||
$dummy = $this->getMock(DummyTest::class, ['__toString']);
|
$dummy = $this->createPartialMock(DummyTest::class, ['__toString']);
|
||||||
}
|
}
|
||||||
$dummy->expects($this->atLeastOnce())
|
$dummy->expects($this->atLeastOnce())
|
||||||
->method('__toString')
|
->method('__toString')
|
||||||
|
@ -92,8 +92,8 @@ class TimezoneTransformer extends Transformer
|
|||||||
*
|
*
|
||||||
* @return string A timezone identifier
|
* @return string A timezone identifier
|
||||||
*
|
*
|
||||||
* @see http://php.net/manual/en/timezones.others.php
|
* @see http://php.net/manual/en/timezones.others.php
|
||||||
* @see http://www.twinsun.com/tz/tz-link.htm
|
* @see http://www.twinsun.com/tz/tz-link.htm
|
||||||
*
|
*
|
||||||
* @throws NotImplementedException When the GMT time zone have minutes offset different than zero
|
* @throws NotImplementedException When the GMT time zone have minutes offset different than zero
|
||||||
* @throws \InvalidArgumentException When the value can not be matched with pattern
|
* @throws \InvalidArgumentException When the value can not be matched with pattern
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Lock\Tests\Store;
|
namespace Symfony\Component\Lock\Tests\Store;
|
||||||
|
|
||||||
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
|
|
||||||
use Symfony\Component\Lock\Exception\LockExpiredException;
|
use Symfony\Component\Lock\Exception\LockExpiredException;
|
||||||
use Symfony\Component\Lock\Key;
|
use Symfony\Component\Lock\Key;
|
||||||
use Symfony\Component\Lock\StoreInterface;
|
use Symfony\Component\Lock\StoreInterface;
|
||||||
|
@ -13,7 +13,6 @@ namespace Symfony\Component\Yaml\Tests;
|
|||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
|
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
|
||||||
use Symfony\Component\Yaml\Exception\ParseException;
|
|
||||||
use Symfony\Component\Yaml\Parser;
|
use Symfony\Component\Yaml\Parser;
|
||||||
use Symfony\Component\Yaml\Tag\TaggedValue;
|
use Symfony\Component\Yaml\Tag\TaggedValue;
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
Reference in New Issue
Block a user