Skip to content

Commit

Permalink
Fix sets
Browse files Browse the repository at this point in the history
  • Loading branch information
SpacePossum committed Nov 8, 2020
1 parent 5632048 commit a82978b
Show file tree
Hide file tree
Showing 15 changed files with 126 additions and 8 deletions.
2 changes: 2 additions & 0 deletions doc/ruleSets/PHPUnit50MigrationRisky.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ Rules

- `@PHPUnit48Migration:risky <./PHPUnit48MigrationRisky.rst>`_
- `php_unit_dedicate_assert <./../rules/php_unit/php_unit_dedicate_assert.rst>`_
config:
``['target' => '5.0']``
2 changes: 2 additions & 0 deletions doc/ruleSets/PHPUnit75MigrationRisky.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ Rules

- `@PHPUnit60Migration:risky <./PHPUnit60MigrationRisky.rst>`_
- `php_unit_dedicate_assert_internal_type <./../rules/php_unit/php_unit_dedicate_assert_internal_type.rst>`_
config:
``['target' => '7.5']``
14 changes: 14 additions & 0 deletions doc/ruleSets/PHPUnit84MigrationRisky.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
======================================
Rule set ``@PHPUnit84Migration:risky``
======================================

Rules to improve tests code for PHPUnit 7.5 compatibility This set contains rules that are risky.

Rules
-----

- `@PHPUnit60Migration:risky <./PHPUnit60MigrationRisky.rst>`_
- `@PHPUnit75Migration:risky <./PHPUnit75MigrationRisky.rst>`_
- `php_unit_expectation <./../rules/php_unit/php_unit_expectation.rst>`_
config:
``['target' => '8.4']``
1 change: 1 addition & 0 deletions doc/ruleSets/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ List of Available Rule sets
- `@PHPUnit57Migration:risky <./PHPUnit57MigrationRisky.rst>`_
- `@PHPUnit60Migration:risky <./PHPUnit60MigrationRisky.rst>`_
- `@PHPUnit75Migration:risky <./PHPUnit75MigrationRisky.rst>`_
- `@PHPUnit84Migration:risky <./PHPUnit84MigrationRisky.rst>`_
- `@PSR1 <./PSR1.rst>`_
- `@PSR2 <./PSR2.rst>`_
- `@PhpCsFixer <./PhpCsFixer.rst>`_
Expand Down
21 changes: 17 additions & 4 deletions doc/rules/php_unit/php_unit_dedicate_assert.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,24 @@ The rule is part of the following rule sets:
``['target' => '3.5']``

@PHPUnit50Migration:risky
Using the `@PHPUnit50Migration:risky <./../../ruleSets/PHPUnit50MigrationRisky.rst>`_ rule set will enable the ``php_unit_dedicate_assert`` rule with the default config.
Using the `@PHPUnit50Migration:risky <./../../ruleSets/PHPUnit50MigrationRisky.rst>`_ rule set will enable the ``php_unit_dedicate_assert`` rule with the config below:

``['target' => '5.0']``

@PHPUnit52Migration:risky
Using the `@PHPUnit52Migration:risky <./../../ruleSets/PHPUnit52MigrationRisky.rst>`_ rule set will enable the ``php_unit_dedicate_assert`` rule with the default config.
Using the `@PHPUnit52Migration:risky <./../../ruleSets/PHPUnit52MigrationRisky.rst>`_ rule set will enable the ``php_unit_dedicate_assert`` rule with the config below:

``['target' => '5.0']``

@PHPUnit54Migration:risky
Using the `@PHPUnit54Migration:risky <./../../ruleSets/PHPUnit54MigrationRisky.rst>`_ rule set will enable the ``php_unit_dedicate_assert`` rule with the default config.
Using the `@PHPUnit54Migration:risky <./../../ruleSets/PHPUnit54MigrationRisky.rst>`_ rule set will enable the ``php_unit_dedicate_assert`` rule with the config below:

``['target' => '5.0']``

@PHPUnit55Migration:risky
Using the `@PHPUnit55Migration:risky <./../../ruleSets/PHPUnit55MigrationRisky.rst>`_ rule set will enable the ``php_unit_dedicate_assert`` rule with the default config.
Using the `@PHPUnit55Migration:risky <./../../ruleSets/PHPUnit55MigrationRisky.rst>`_ rule set will enable the ``php_unit_dedicate_assert`` rule with the config below:

``['target' => '5.0']``

@PHPUnit56Migration:risky
Using the `@PHPUnit56Migration:risky <./../../ruleSets/PHPUnit56MigrationRisky.rst>`_ rule set will enable the ``php_unit_dedicate_assert`` rule with the config below:
Expand All @@ -138,3 +146,8 @@ The rule is part of the following rule sets:
Using the `@PHPUnit75Migration:risky <./../../ruleSets/PHPUnit75MigrationRisky.rst>`_ rule set will enable the ``php_unit_dedicate_assert`` rule with the config below:

``['target' => '5.6']``

@PHPUnit84Migration:risky
Using the `@PHPUnit84Migration:risky <./../../ruleSets/PHPUnit84MigrationRisky.rst>`_ rule set will enable the ``php_unit_dedicate_assert`` rule with the config below:

``['target' => '5.6']``
11 changes: 9 additions & 2 deletions doc/rules/php_unit/php_unit_dedicate_assert_internal_type.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ Example #1
Rule sets
---------

The rule is part of the following rule set:
The rule is part of the following rule sets:

@PHPUnit75Migration:risky
Using the `@PHPUnit75Migration:risky <./../../ruleSets/PHPUnit75MigrationRisky.rst>`_ rule set will enable the ``php_unit_dedicate_assert_internal_type`` rule with the default config.
Using the `@PHPUnit75Migration:risky <./../../ruleSets/PHPUnit75MigrationRisky.rst>`_ rule set will enable the ``php_unit_dedicate_assert_internal_type`` rule with the config below:

``['target' => '7.5']``

@PHPUnit84Migration:risky
Using the `@PHPUnit84Migration:risky <./../../ruleSets/PHPUnit84MigrationRisky.rst>`_ rule set will enable the ``php_unit_dedicate_assert_internal_type`` rule with the config below:

``['target' => '7.5']``
5 changes: 5 additions & 0 deletions doc/rules/php_unit/php_unit_expectation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,8 @@ The rule is part of the following rule sets:
Using the `@PHPUnit75Migration:risky <./../../ruleSets/PHPUnit75MigrationRisky.rst>`_ rule set will enable the ``php_unit_expectation`` rule with the config below:

``['target' => '5.6']``

@PHPUnit84Migration:risky
Using the `@PHPUnit84Migration:risky <./../../ruleSets/PHPUnit84MigrationRisky.rst>`_ rule set will enable the ``php_unit_expectation`` rule with the config below:

``['target' => '8.4']``
5 changes: 5 additions & 0 deletions doc/rules/php_unit/php_unit_mock.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,8 @@ The rule is part of the following rule sets:
Using the `@PHPUnit75Migration:risky <./../../ruleSets/PHPUnit75MigrationRisky.rst>`_ rule set will enable the ``php_unit_mock`` rule with the config below:

``['target' => '5.5']``

@PHPUnit84Migration:risky
Using the `@PHPUnit84Migration:risky <./../../ruleSets/PHPUnit84MigrationRisky.rst>`_ rule set will enable the ``php_unit_mock`` rule with the config below:

``['target' => '5.5']``
5 changes: 5 additions & 0 deletions doc/rules/php_unit/php_unit_namespaced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,8 @@ The rule is part of the following rule sets:
Using the `@PHPUnit75Migration:risky <./../../ruleSets/PHPUnit75MigrationRisky.rst>`_ rule set will enable the ``php_unit_namespaced`` rule with the config below:

``['target' => '6.0']``

@PHPUnit84Migration:risky
Using the `@PHPUnit84Migration:risky <./../../ruleSets/PHPUnit84MigrationRisky.rst>`_ rule set will enable the ``php_unit_namespaced`` rule with the config below:

``['target' => '6.0']``
5 changes: 5 additions & 0 deletions doc/rules/php_unit/php_unit_no_expectation_annotation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,8 @@ The rule is part of the following rule sets:
Using the `@PHPUnit75Migration:risky <./../../ruleSets/PHPUnit75MigrationRisky.rst>`_ rule set will enable the ``php_unit_no_expectation_annotation`` rule with the config below:

``['target' => '4.3']``

@PHPUnit84Migration:risky
Using the `@PHPUnit84Migration:risky <./../../ruleSets/PHPUnit84MigrationRisky.rst>`_ rule set will enable the ``php_unit_no_expectation_annotation`` rule with the config below:

``['target' => '4.3']``
2 changes: 1 addition & 1 deletion src/RuleSet/Sets/PHPUnit75MigrationRiskySet.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function getRules()
return [
'@PHPUnit60Migration:risky' => true,
'php_unit_dedicate_assert_internal_type' => [
'target' => '7.5'
'target' => '7.5',
],
];
}
Expand Down
37 changes: 37 additions & 0 deletions src/RuleSet/Sets/PHPUnit84MigrationRiskySet.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <[email protected]>
* Dariusz Rumiński <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace PhpCsFixer\RuleSet\Sets;

use PhpCsFixer\RuleSet\AbstractRuleSetDescription;

/**
* @internal
*/
final class PHPUnit84MigrationRiskySet extends AbstractRuleSetDescription
{
public function getRules()
{
return [
'@PHPUnit60Migration:risky' => true,
'@PHPUnit75Migration:risky' => true,
'php_unit_expectation' => [
'target' => '8.4',
],
];
}

public function getDescription()
{
return 'Rules to improve tests code for PHPUnit 7.5 compatibility';
}
}
1 change: 0 additions & 1 deletion tests/RuleSet/RuleSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ public function testResolveRulesWithDisabledSet()
'braces' => true,
'constant_case' => true,
'class_definition' => true,
'constant_case' => true,
'elseif' => true,
'encoding' => true,
'function_declaration' => true,
Expand Down
1 change: 1 addition & 0 deletions tests/RuleSet/RuleSetsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function testHasIntegrationTest($setDefinitionName)
'@PHPUnit48Migration',
'@PHPUnit55Migration:risky',
'@PHPUnit75Migration:risky',
'@PHPUnit84Migration:risky',
'@PSR1',
];

Expand Down
22 changes: 22 additions & 0 deletions tests/RuleSet/Sets/PHPUnit84MigrationRiskySetTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <[email protected]>
* Dariusz Rumiński <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace PhpCsFixer\Tests\RuleSet\Sets;

/**
* @internal
*
* @covers \PhpCsFixer\RuleSet\Sets\PHPUnit84MigrationRiskySet
*/
final class PHPUnit84MigrationRiskySetTest extends AbstractSetTest
{
}

0 comments on commit a82978b

Please sign in to comment.