Skip to content

Commit f1ec131

Browse files
committed
skip FinalizeTestCaseClassRector and DeclareStrictTypesTestsRector config
1 parent 0e1753d commit f1ec131

File tree

10 files changed

+32
-30
lines changed

10 files changed

+32
-30
lines changed

rector.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
use Rector\PHPUnit\CodeQuality\Rector\Class_\RemoveDataProviderParamKeysRector;
3838
use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
3939
use Rector\PHPUnit\CodeQuality\Rector\FuncCall\AssertFuncCallToPHPUnitAssertRector;
40+
use Rector\PHPUnit\CodeQuality\Rector\StmtsAwareInterface\DeclareStrictTypesTestsRector;
4041
use Rector\Privatization\Rector\Class_\FinalizeTestCaseClassRector;
4142
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
4243
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
@@ -180,8 +181,11 @@
180181
__DIR__ . '/tests/system/AutoReview/FrameworkCodeTest.php',
181182
],
182183

183-
FinalizeTestCaseClassRector::class => [
184-
__DIR__ . '/tests/system/Validation/FormatRulesTest.php',
184+
// some tests extended by other tests
185+
FinalizeTestCaseClassRector::class,
186+
187+
DeclareStrictTypesTestsRector::class => [
188+
__DIR__ . '/tests/system/Debug/ExceptionsTest.php',
185189
],
186190
])
187191
// auto import fully qualified class names

tests/system/Autoloader/FileLocatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
* @no-final
2626
*/
2727
#[Group('Others')]
28-
final class FileLocatorTest extends CIUnitTestCase
28+
class FileLocatorTest extends CIUnitTestCase
2929
{
3030
/**
3131
* @var FileLocator|FileLocatorCached
3232
*/
33-
private FileLocatorInterface $locator;
33+
protected FileLocatorInterface $locator;
3434

3535
protected function setUp(): void
3636
{

tests/system/Database/Live/TransactionDBDebugTrueTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* @no-final
2727
*/
2828
#[Group('DatabaseLive')]
29-
final class TransactionDBDebugTrueTest extends CIUnitTestCase
29+
class TransactionDBDebugTrueTest extends CIUnitTestCase
3030
{
3131
use DatabaseTestTrait;
3232

tests/system/Debug/ExceptionsTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
declare(strict_types=1);
4-
53
/**
64
* This file is part of CodeIgniter 4 framework.
75
*

tests/system/HTTP/CURLRequestTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
* @no-final
3131
*/
3232
#[Group('Others')]
33-
final class CURLRequestTest extends CIUnitTestCase
33+
class CURLRequestTest extends CIUnitTestCase
3434
{
35-
private MockCURLRequest $request;
35+
protected MockCURLRequest $request;
3636

3737
protected function setUp(): void
3838
{

tests/system/Validation/RulesTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
* @no-final
2727
*/
2828
#[Group('Others')]
29-
final class RulesTest extends CIUnitTestCase
29+
class RulesTest extends CIUnitTestCase
3030
{
31-
private Validation $validation;
31+
protected Validation $validation;
3232

3333
/**
3434
* @var array<string, array<int|string, array<string, string>|string>>
3535
*/
36-
private array $config = [
36+
protected array $config = [
3737
'ruleSets' => [
3838
Rules::class,
3939
FormatRules::class,

tests/system/Validation/StrictRules/CreditCardRulesTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
* @no-final
2626
*/
2727
#[Group('Others')]
28-
final class CreditCardRulesTest extends CIUnitTestCase
28+
class CreditCardRulesTest extends CIUnitTestCase
2929
{
30-
private Validation $validation;
30+
protected Validation $validation;
3131

3232
/**
3333
* @var array<string, array<int|string, array<string, string>|string>>
3434
*/
35-
private array $config = [
35+
protected array $config = [
3636
'ruleSets' => [
3737
Rules::class,
3838
FormatRules::class,

tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
* @no-final
2929
*/
3030
#[Group('DatabaseLive')]
31-
final class DatabaseRelatedRulesTest extends CIUnitTestCase
31+
class DatabaseRelatedRulesTest extends CIUnitTestCase
3232
{
3333
use DatabaseTestTrait;
3434

35-
private Validation $validation;
35+
protected Validation $validation;
3636

3737
/**
3838
* @var array{
@@ -41,7 +41,7 @@ final class DatabaseRelatedRulesTest extends CIUnitTestCase
4141
* groupA_errors: array<string, array<string, string>>,
4242
* }
4343
*/
44-
private array $config = [
44+
protected array $config = [
4545
'ruleSets' => [
4646
Rules::class,
4747
FormatRules::class,

tests/system/Validation/StrictRules/FileRulesTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
* @no-final
2626
*/
2727
#[Group('Others')]
28-
final class FileRulesTest extends CIUnitTestCase
28+
class FileRulesTest extends CIUnitTestCase
2929
{
30-
private Validation $validation;
30+
protected Validation $validation;
3131

3232
/**
3333
* @var array<string, array<int|string, array<string, string>|string>>
3434
*/
35-
private array $config = [
35+
protected array $config = [
3636
'ruleSets' => [
3737
Rules::class,
3838
FormatRules::class,

tests/system/Validation/ValidationTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@
3333
* @no-final
3434
*/
3535
#[Group('Others')]
36-
final class ValidationTest extends CIUnitTestCase
36+
class ValidationTest extends CIUnitTestCase
3737
{
38-
private Validation $validation;
38+
protected Validation $validation;
3939

4040
/**
4141
* @var array<string, array<int|string, array<string, array<string, string>|string>|string>|string>
4242
*/
43-
private static array $config = [
43+
protected static array $config = [
4444
'ruleSets' => [
4545
Rules::class,
4646
FormatRules::class,
@@ -82,7 +82,7 @@ final class ValidationTest extends CIUnitTestCase
8282
protected function setUp(): void
8383
{
8484
parent::setUp();
85-
$this->validation = new Validation((object) self::$config, service('renderer'));
85+
$this->validation = new Validation((object) static::$config, service('renderer'));
8686
$this->validation->reset();
8787
}
8888

@@ -227,7 +227,7 @@ public static function provideSetRuleRulesFormat(): iterable
227227

228228
yield 'fail-deep-object' => [
229229
false,
230-
new Validation((object) self::$config, service('renderer')),
230+
new Validation((object) static::$config, service('renderer')),
231231
];
232232

233233
yield 'pass-multiple-string' => [
@@ -1007,18 +1007,18 @@ public function testShowBadTemplate(): void
10071007
public function testNoRuleSetsSetup(): void
10081008
{
10091009
try {
1010-
$rulesets = self::$config['ruleSets'];
1010+
$rulesets = static::$config['ruleSets'];
10111011

1012-
self::$config['ruleSets'] = null;
1013-
(new Validation((object) self::$config, service('renderer')))
1012+
static::$config['ruleSets'] = null;
1013+
(new Validation((object) static::$config, service('renderer')))
10141014
->reset()
10151015
->run(['foo' => '']);
10161016

10171017
$this->fail(sprintf('%s should throw %s.', __METHOD__, ValidationException::class));
10181018
} catch (Throwable $e) {
10191019
$this->assertInstanceOf(ValidationException::class, $e);
10201020
} finally {
1021-
self::$config['ruleSets'] = $rulesets;
1021+
static::$config['ruleSets'] = $rulesets;
10221022
}
10231023
}
10241024

0 commit comments

Comments
 (0)