Skip to content

Commit

Permalink
DX: use PHPUnit's "requires" instead of "if" condition (#6975)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos committed May 19, 2023
1 parent 96d8856 commit a3ed743
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
6 changes: 2 additions & 4 deletions tests/Fixer/CastNotation/LowercaseCastFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ public function testFix(string $expected, ?string $input = null): void
* @dataProvider provideFixDeprecatedCases
*
* @group legacy
*
* @requires PHP <8.0
*/
public function testFix74Deprecated(string $expected, ?string $input = null): void
{
if (\PHP_VERSION_ID >= 8_00_00) {
self::markTestSkipped('PHP < 8.0 is required.');
}

$this->expectDeprecation('%AThe (real) cast is deprecated, use (float) instead');

$this->doTest($expected, $input);
Expand Down
6 changes: 2 additions & 4 deletions tests/Fixer/CastNotation/ShortScalarCastFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ public function testFix(string $expected, ?string $input = null): void
* @dataProvider provideFixDeprecatedCases
*
* @group legacy
*
* @requires PHP <8.0
*/
public function testFix74Deprecated(string $expected, ?string $input = null): void
{
if (\PHP_VERSION_ID >= 8_00_00) {
self::markTestSkipped('PHP < 8.0 is required.');
}

$this->expectDeprecation('%AThe (real) cast is deprecated, use (float) instead');

$this->doTest($expected, $input);
Expand Down
6 changes: 2 additions & 4 deletions tests/Tokenizer/Transformer/NameQualifiedTransformerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ final class NameQualifiedTransformerTest extends AbstractTransformerTestCase
* @param null|Token[] $input
*
* @dataProvider provideProcessCases
*
* @requires PHP 8.0
*/
public function testProcess(array $expected, array $input = null): void
{
Expand All @@ -62,10 +64,6 @@ public function testProcess(array $expected, array $input = null): void

public static function provideProcessCases(): iterable
{
if (\PHP_VERSION_ID < 8_00_00) {
return; // PHPUnit still calls this for no reason on non PHP8.0
}

yield 'string' => [
[
new Token([T_OPEN_TAG, "<?php\n"]),
Expand Down

0 comments on commit a3ed743

Please sign in to comment.