Skip to content

Commit 6a9fadd

Browse files
committed
cs fixer
1 parent e079b71 commit 6a9fadd

16 files changed

+153
-89
lines changed

src/Event/Value/TestSuite/TestSuiteBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010
namespace PHPUnit\Event\TestSuite;
1111

12-
use PHPUnit\Framework\RepeatTestSuite;
1312
use function assert;
1413
use function class_exists;
1514
use function count;
@@ -19,6 +18,7 @@
1918
use PHPUnit\Event\Code\TestCollection;
2019
use PHPUnit\Event\RuntimeException;
2120
use PHPUnit\Framework\DataProviderTestSuite;
21+
use PHPUnit\Framework\RepeatTestSuite;
2222
use PHPUnit\Framework\TestCase;
2323
use PHPUnit\Framework\TestSuite as FrameworkTestSuite;
2424
use PHPUnit\Runner\Phpt\TestCase as PhptTestCase;

src/Framework/RepeatTestSuite.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,31 @@
99
*/
1010
namespace PHPUnit\Framework;
1111

12+
use function count;
13+
use PHPUnit\Event;
1214
use PHPUnit\Event\Facade as EventFacade;
1315
use PHPUnit\Runner\Phpt\TestCase as PhptTestCase;
1416
use PHPUnit\TestRunner\TestResult\PassedTests;
15-
use PHPUnit\Event;
1617

1718
/**
1819
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
1920
*
2021
* @internal This class is not covered by the backward compatibility promise for PHPUnit
2122
*/
22-
final class RepeatTestSuite implements Test, Reorderable
23+
final class RepeatTestSuite implements Reorderable, Test
2324
{
2425
/**
25-
* @var non-empty-list<TestCase>|non-empty-list<PhptTestCase>
26+
* @var non-empty-list<PhptTestCase>|non-empty-list<TestCase>
2627
*/
2728
private array $tests;
2829

2930
/**
3031
* @param positive-int $times
3132
*/
32-
public function __construct(TestCase|PhptTestCase $test, int $times)
33+
public function __construct(PhptTestCase|TestCase $test, int $times)
3334
{
3435
$tests = [];
36+
3537
for ($i = 0; $i < $times; $i++) {
3638
$tests[] = clone $test;
3739
}
@@ -73,7 +75,7 @@ public function nameWithDataSet(): string
7375
return $this->tests[0]->nameWithDataSet();
7476
}
7577

76-
public function valueObjectForEvents(): Event\Code\TestMethod|Event\Code\Phpt
78+
public function valueObjectForEvents(): Event\Code\Phpt|Event\Code\TestMethod
7779
{
7880
return $this->tests[0]->valueObjectForEvents();
7981
}

src/Framework/TestBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* @param ReflectionClass<TestCase> $theClass
3737
* @param non-empty-string $methodName
3838
* @param list<non-empty-string> $groups
39-
* @param positive-int $repeat
39+
* @param positive-int $repeat
4040
*
4141
* @throws InvalidDataProviderException
4242
*/
@@ -87,7 +87,7 @@ public function build(ReflectionClass $theClass, string $methodName, array $grou
8787
* @param array<ProvidedData> $data
8888
* @param array{backupGlobals: ?true, backupGlobalsExcludeList: list<string>, backupStaticProperties: ?true, backupStaticPropertiesExcludeList: array<string,list<string>>} $backupSettings
8989
* @param list<non-empty-string> $groups
90-
* @param positive-int $repeat
90+
* @param positive-int $repeat
9191
*/
9292
private function buildDataProviderTestSuite(string $methodName, string $className, array $data, bool $runTestInSeparateProcess, ?bool $preserveGlobalState, array $backupSettings, array $groups, int $repeat = 1): DataProviderTestSuite
9393
{

src/Framework/TestCase.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,18 @@ final public function wasPrepared(): bool
965965
return $this->wasPrepared;
966966
}
967967

968+
public function markSkippedForErrorInPreviousRepetition(): void
969+
{
970+
$message = 'Test repetition failure';
971+
972+
Event\Facade::emitter()->testSkipped(
973+
$this->valueObjectForEvents(),
974+
$message,
975+
);
976+
977+
$this->status = TestStatus::skipped($message);
978+
}
979+
968980
/**
969981
* Returns a matcher that matches when the method is executed
970982
* zero or more times.
@@ -1543,18 +1555,6 @@ private function markSkippedForMissingDependency(ExecutionOrderDependency $depen
15431555
$this->status = TestStatus::skipped($message);
15441556
}
15451557

1546-
public function markSkippedForErrorInPreviousRepetition(): void
1547-
{
1548-
$message = 'Test repetition failure';
1549-
1550-
Event\Facade::emitter()->testSkipped(
1551-
$this->valueObjectForEvents(),
1552-
$message,
1553-
);
1554-
1555-
$this->status = TestStatus::skipped($message);
1556-
}
1557-
15581558
private function startOutputBuffering(): void
15591559
{
15601560
ob_start();

src/Framework/TestSuite.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public static function empty(string $name): static
9696
/**
9797
* @param ReflectionClass<TestCase> $class
9898
* @param list<non-empty-string> $groups
99-
* @param positive-int $repeat
99+
* @param positive-int $repeat
100100
*/
101101
public static function fromClassReflector(ReflectionClass $class, array $groups = [], int $repeat = 1): static
102102
{
@@ -146,7 +146,7 @@ final private function __construct(string $name)
146146
* Adds a test to the suite.
147147
*
148148
* @param list<non-empty-string> $groups
149-
* @param positive-int $repeat
149+
* @param positive-int $repeat
150150
*/
151151
public function addTest(Test $test, array $groups = [], int $repeat = 1): void
152152
{
@@ -194,7 +194,7 @@ public function addTest(Test $test, array $groups = [], int $repeat = 1): void
194194
*
195195
* @param ReflectionClass<TestCase> $testClass
196196
* @param list<non-empty-string> $groups
197-
* @param positive-int $repeat
197+
* @param positive-int $repeat
198198
*
199199
* @throws Exception
200200
*/
@@ -231,7 +231,7 @@ public function addTestSuite(ReflectionClass $testClass, array $groups = [], int
231231
* leaving the current test run untouched.
232232
*
233233
* @param list<non-empty-string> $groups
234-
* @param positive-int $repeat
234+
* @param positive-int $repeat
235235
*
236236
* @throws Exception
237237
*/
@@ -258,7 +258,7 @@ public function addTestFile(string $filename, array $groups = [], int $repeat =
258258
* Wrapper for addTestFile() that adds multiple test files.
259259
*
260260
* @param iterable<string> $fileNames
261-
* @param positive-int $repeat
261+
* @param positive-int $repeat
262262
*
263263
* @throws Exception
264264
*/
@@ -513,7 +513,7 @@ public function isForTestClass(): bool
513513
/**
514514
* @param ReflectionClass<TestCase> $class
515515
* @param list<non-empty-string> $groups
516-
* @param positive-int $repeat
516+
* @param positive-int $repeat
517517
*
518518
* @throws Exception
519519
*/

src/Runner/Phpt/TestCase.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ final class TestCase implements Reorderable, SelfDescribing, Test
7676
* @var non-empty-string
7777
*/
7878
private readonly string $filename;
79-
8079
private bool $passed = false;
8180

8281
/**

src/TextUI/Configuration/Configuration.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@
194194
*/
195195
private ?string $generateBaseline;
196196
private bool $debug;
197+
197198
/**
198199
* @var positive-int
199200
*/
@@ -217,8 +218,8 @@
217218
* @param list<non-empty-string> $excludeGroups
218219
* @param non-empty-list<non-empty-string> $testSuffixes
219220
* @param null|non-empty-string $generateBaseline
220-
* @param non-negative-int $shortenArraysForExportThreshold
221221
* @param positive-int $repeat
222+
* @param non-negative-int $shortenArraysForExportThreshold
222223
*/
223224
public function __construct(array $cliArguments, ?string $configurationFile, ?string $bootstrap, array $bootstrapForTestSuite, bool $cacheResult, ?string $cacheDirectory, ?string $coverageCacheDirectory, Source $source, string $testResultCacheFile, ?string $coverageClover, ?string $coverageCobertura, ?string $coverageCrap4j, int $coverageCrap4jThreshold, ?string $coverageHtml, int $coverageHtmlLowUpperBound, int $coverageHtmlHighLowerBound, string $coverageHtmlColorSuccessLow, string $coverageHtmlColorSuccessMedium, string $coverageHtmlColorSuccessHigh, string $coverageHtmlColorWarning, string $coverageHtmlColorDanger, ?string $coverageHtmlCustomCssFile, ?string $coverageOpenClover, ?string $coveragePhp, ?string $coverageText, bool $coverageTextShowUncoveredFiles, bool $coverageTextShowOnlySummary, ?string $coverageXml, bool $pathCoverage, bool $ignoreDeprecatedCodeUnitsFromCodeCoverage, bool $disableCodeCoverageIgnore, bool $failOnAllIssues, bool $failOnDeprecation, bool $failOnPhpunitDeprecation, bool $failOnPhpunitNotice, bool $failOnPhpunitWarning, bool $failOnEmptyTestSuite, bool $failOnIncomplete, bool $failOnNotice, bool $failOnRisky, bool $failOnSkipped, bool $failOnWarning, bool $doNotFailOnDeprecation, bool $doNotFailOnPhpunitDeprecation, bool $doNotFailOnPhpunitNotice, bool $doNotFailOnPhpunitWarning, bool $doNotFailOnEmptyTestSuite, bool $doNotFailOnIncomplete, bool $doNotFailOnNotice, bool $doNotFailOnRisky, bool $doNotFailOnSkipped, bool $doNotFailOnWarning, bool $stopOnDefect, bool $stopOnDeprecation, ?string $specificDeprecationToStopOn, bool $stopOnError, bool $stopOnFailure, bool $stopOnIncomplete, bool $stopOnNotice, bool $stopOnRisky, bool $stopOnSkipped, bool $stopOnWarning, bool $outputToStandardErrorStream, int $columns, bool $noExtensions, ?string $pharExtensionDirectory, array $extensionBootstrappers, bool $backupGlobals, bool $backupStaticProperties, bool $beStrictAboutChangesToGlobalState, bool $colors, bool $processIsolation, bool $enforceTimeLimit, int $defaultTimeLimit, int $timeoutForSmallTests, int $timeoutForMediumTests, int $timeoutForLargeTests, bool $reportUselessTests, bool $strictCoverage, bool $disallowTestOutput, bool $displayDetailsOnAllIssues, bool $displayDetailsOnIncompleteTests, bool $displayDetailsOnSkippedTests, bool $displayDetailsOnTestsThatTriggerDeprecations, bool $displayDetailsOnPhpunitDeprecations, bool $displayDetailsOnPhpunitNotices, bool $displayDetailsOnTestsThatTriggerErrors, bool $displayDetailsOnTestsThatTriggerNotices, bool $displayDetailsOnTestsThatTriggerWarnings, bool $reverseDefectList, bool $requireCoverageMetadata, bool $noProgress, bool $noResults, bool $noOutput, int $executionOrder, int $executionOrderDefects, bool $resolveDependencies, ?string $logfileTeamcity, ?string $logfileJunit, ?string $logfileOtr, bool $includeGitInformationInOtrLogfile, ?string $logfileTestdoxHtml, ?string $logfileTestdoxText, ?string $logEventsText, ?string $logEventsVerboseText, bool $teamCityOutput, bool $testDoxOutput, bool $testDoxOutputSummary, ?array $testsCovering, ?array $testsUsing, ?array $testsRequiringPhpExtension, ?string $filter, ?string $excludeFilter, array $groups, array $excludeGroups, int $randomOrderSeed, bool $includeUncoveredFiles, TestSuiteCollection $testSuite, string $includeTestSuite, string $excludeTestSuite, ?string $defaultTestSuite, bool $ignoreTestSelectionInXmlConfiguration, array $testSuffixes, Php $php, bool $controlGarbageCollector, int $numberOfTestsBeforeGarbageCollection, ?string $generateBaseline, bool $debug, int $repeat, bool $withTelemetry, int $shortenArraysForExportThreshold)
224225
{
@@ -350,7 +351,7 @@ public function __construct(array $cliArguments, ?string $configurationFile, ?st
350351
$this->numberOfTestsBeforeGarbageCollection = $numberOfTestsBeforeGarbageCollection;
351352
$this->generateBaseline = $generateBaseline;
352353
$this->debug = $debug;
353-
$this->repeat = $repeat;
354+
$this->repeat = $repeat;
354355
$this->withTelemetry = $withTelemetry;
355356
$this->shortenArraysForExportThreshold = $shortenArraysForExportThreshold;
356357
}

src/TextUI/Configuration/TestSuiteBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function build(Configuration $configuration): TestSuite
9090
/**
9191
* @param non-empty-string $path
9292
* @param list<non-empty-string> $suffixes
93-
* @param positive-int $repeat
93+
* @param positive-int $repeat
9494
*
9595
* @throws \PHPUnit\Framework\Exception
9696
*/
@@ -138,7 +138,7 @@ private function testSuiteFromPath(string $path, array $suffixes, int $repeat, ?
138138
/**
139139
* @param list<non-empty-string> $paths
140140
* @param list<non-empty-string> $suffixes
141-
* @param positive-int $repeat
141+
* @param positive-int $repeat
142142
*
143143
* @throws \PHPUnit\Framework\Exception
144144
*/
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
<?php
2-
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
310
use PHPUnit\Framework\Attributes\Depends;
411
use PHPUnit\Framework\TestCase;
512

@@ -10,15 +17,15 @@ public function test1(): void
1017
static $cout = 0;
1118

1219
if ($cout++ > 0) {
13-
self::assertFalse(true);
20+
$this->assertFalse(true);
1421
}
1522

16-
self::assertTrue(true);
23+
$this->assertTrue(true);
1724
}
1825

1926
#[Depends('test1')]
2027
public function test2(): void
2128
{
22-
self::assertTrue(true);
29+
$this->assertTrue(true);
2330
}
2431
}
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,36 @@
1-
<?php
2-
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
310
use PHPUnit\Framework\Attributes\Depends;
411
use PHPUnit\Framework\TestCase;
512

613
final class RepeatDependentTest extends TestCase
714
{
815
public function test1(): void
916
{
10-
self::assertTrue(true);
17+
$this->assertTrue(true);
1118
}
1219

1320
#[Depends('test1')]
1421
public function testDepends1(): void
1522
{
16-
self::assertTrue(true);
23+
$this->assertTrue(true);
1724
}
1825

1926
public function test2(): void
2027
{
21-
self::assertTrue(false);
28+
$this->assertTrue(false);
2229
}
2330

2431
#[Depends('test2')]
2532
public function testDepends2(): void
2633
{
27-
self::assertTrue(true);
34+
$this->assertTrue(true);
2835
}
2936
}

0 commit comments

Comments
 (0)