Skip to content
This repository was archived by the owner on Mar 1, 2023. It is now read-only.

Commit ccdbe7c

Browse files
authored
Configured php_unit_test_case_static_method_calls fixer to use se… (#23)
* Configured php_unit_test_case_static_method_calls fixer to use self call type * feat: added php7.4 * fix: xdebug is missing on php7.4
1 parent 5645b25 commit ccdbe7c

File tree

3 files changed

+28
-21
lines changed

3 files changed

+28
-21
lines changed

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ install:
2121
- $COMPOSER_UP
2222

2323
jobs:
24+
allow_failures:
25+
- php: nightly
26+
- php: 7.4snapshot
27+
2428
include:
2529
- stage: Test
2630
php: 7.1
@@ -31,6 +35,12 @@ jobs:
3135
- stage: Test
3236
php: 7.3
3337
env: REMOVE_XDEBUG=true
38+
- stage: Test
39+
php: 7.4snapshot
40+
# env: REMOVE_XDEBUG=true
41+
- stage: Test
42+
php: nightly
43+
# env: REMOVE_XDEBUG=true
3444

3545
- stage: Coding standard
3646
if: type != cron

src/Config.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ public function getRules(): array
9595
'noise_remaining_usages' => false,
9696
],
9797
'no_superfluous_phpdoc_tags' => false,
98-
'php_unit_test_case_static_method_calls' => [
99-
'call_type' => 'this',
100-
],
10198
'fopen_flags' => false,
10299
'fopen_flag_order' => false,
103100
'php_unit_test_class_requires_covers' => false,

tests/ConfigTest.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ final class ConfigTest extends TestCase
3838
{
3939
public function testImplementsInterface(): void
4040
{
41-
$this->assertInstanceOf(ConfigInterface::class, new Config());
41+
self::assertInstanceOf(ConfigInterface::class, new Config());
4242
}
4343

4444
public function testValues(): void
4545
{
4646
$config = new Config();
4747

48-
$this->assertSame('narrowspark', $config->getName());
48+
self::assertSame('narrowspark', $config->getName());
4949
}
5050

5151
public function testHasPsr2Rules(): void
@@ -90,20 +90,20 @@ public function testIfAllRulesAreTested(): void
9090
$rules = (new Config())->getRules();
9191

9292
foreach ($rules as $key => $value) {
93-
$this->assertTrue(isset($testRules[$key]), '[' . $key . '] Rule is missing.');
93+
self::assertTrue(isset($testRules[$key]), '[' . $key . '] Rule is missing.');
9494
}
9595

96-
$this->assertCount(\count($testRules), $rules);
96+
self::assertCount(\count($testRules), $rules);
9797
}
9898

9999
public function testDoesNotHaveHeaderCommentFixerByDefault(): void
100100
{
101101
$rules = (new Config())->getRules();
102102

103-
$this->assertArrayHasKey('header_comment', $rules);
104-
$this->assertFalse($rules['header_comment']);
105-
$this->assertTrue($rules['no_blank_lines_before_namespace']);
106-
$this->assertFalse($rules['single_blank_line_before_namespace']);
103+
self::assertArrayHasKey('header_comment', $rules);
104+
self::assertFalse($rules['header_comment']);
105+
self::assertTrue($rules['no_blank_lines_before_namespace']);
106+
self::assertFalse($rules['single_blank_line_before_namespace']);
107107
}
108108

109109
public function testHasHeaderCommentFixerIfProvided(): void
@@ -112,17 +112,17 @@ public function testHasHeaderCommentFixerIfProvided(): void
112112
$config = new Config($header);
113113
$rules = $config->getRules();
114114

115-
$this->assertArrayHasKey('header_comment', $rules);
115+
self::assertArrayHasKey('header_comment', $rules);
116116

117117
$expected = [
118118
'comment_type' => 'PHPDoc',
119119
'header' => $header,
120120
'location' => 'after_declare_strict',
121121
'separate' => 'both',
122122
];
123-
$this->assertSame($expected, $rules['header_comment']);
124-
$this->assertTrue($rules['no_blank_lines_before_namespace']);
125-
$this->assertFalse($rules['single_blank_line_before_namespace']);
123+
self::assertSame($expected, $rules['header_comment']);
124+
self::assertTrue($rules['no_blank_lines_before_namespace']);
125+
self::assertFalse($rules['single_blank_line_before_namespace']);
126126
}
127127

128128
public function testAllConfiguredRulesAreBuiltIn(): void
@@ -148,7 +148,7 @@ public function testAllConfiguredRulesAreBuiltIn(): void
148148
\array_merge($this->builtInFixers(), $pedroTrollerRules, $kubawerlosRules)
149149
);
150150

151-
$this->assertEmpty($fixersNotBuiltIn, \sprintf(
151+
self::assertEmpty($fixersNotBuiltIn, \sprintf(
152152
'Failed to assert that fixers for the rules "%s" are built in',
153153
\implode('", "', $fixersNotBuiltIn)
154154
));
@@ -168,13 +168,13 @@ public function testDoesNotHaveRulesEnabled(string $fixer, $reason): void
168168
];
169169

170170
if ($fixer === 'array_syntax') {
171-
$this->assertNotSame(['syntax' => 'long'], $config->getRules()['array_syntax'], \sprintf(
171+
self::assertNotSame(['syntax' => 'long'], $config->getRules()['array_syntax'], \sprintf(
172172
'Fixer "%s" should not be enabled, because "%s"',
173173
$fixer,
174174
$reason['long']
175175
));
176176
} else {
177-
$this->assertArraySubset($rule, $config->getRules(), true, \sprintf(
177+
self::assertArraySubset($rule, $config->getRules(), true, \sprintf(
178178
'Fixer "%s" should not be enabled, because "%s"',
179179
$fixer,
180180
$reason
@@ -426,7 +426,7 @@ private function getPHPUnitRules(): array
426426
'use_class_const' => true,
427427
],
428428
'php_unit_test_case_static_method_calls' => [
429-
'call_type' => 'this',
429+
'call_type' => 'self',
430430
],
431431
'php_unit_internal_class' => [
432432
'types' => [
@@ -629,12 +629,12 @@ private function getSymfonyRules(): array
629629
private function assertHasRules(array $expected, array $actual, string $set): void
630630
{
631631
foreach ($expected as $fixer => $isEnabled) {
632-
$this->assertArrayHasKey($fixer, $actual, \sprintf(
632+
self::assertArrayHasKey($fixer, $actual, \sprintf(
633633
'Failed to assert that a rule for fixer "%s" (in set "%s") exists.,',
634634
$fixer,
635635
$set
636636
));
637-
$this->assertSame($isEnabled, $actual[$fixer], \sprintf(
637+
self::assertSame($isEnabled, $actual[$fixer], \sprintf(
638638
'Failed to assert that fixer "%s" (in set "%s") is %s.',
639639
$fixer,
640640
$set,

0 commit comments

Comments
 (0)