diff --git a/CHANGELOG.md b/CHANGELOG.md index fd43a015..3da963c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ For a full diff see [`7afa59c...main`][7afa59c...main]. * Added `Comparator\DurationComparator` ([#18]), by [@localheinz] * Added `SlowTestReporter` ([#19]), by [@localheinz] +### Changed + +* Renamed `SlowTestReporter` to `Reporter\DefaultReporter` ([#20]), by [@localheinz] + [7afa59c...main]: https://github.com/ergebnis/phpunit-slow-test-detector/compare/7afa59c...main [#6]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/6 @@ -27,5 +31,6 @@ For a full diff see [`7afa59c...main`][7afa59c...main]. [#17]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/17 [#18]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/18 [#19]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/19 +[#20]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/20 [@localheinz]: https://github.com/localheinz diff --git a/src/SlowTestReporter.php b/src/Reporter/Reporter.php similarity index 94% rename from src/SlowTestReporter.php rename to src/Reporter/Reporter.php index cbe50b65..40c36caf 100644 --- a/src/SlowTestReporter.php +++ b/src/Reporter/Reporter.php @@ -11,11 +11,14 @@ * @see https://github.com/ergebnis/phpunit-slow-test-detector */ -namespace Ergebnis\PHPUnit\SlowTestDetector; +namespace Ergebnis\PHPUnit\SlowTestDetector\Reporter; +use Ergebnis\PHPUnit\SlowTestDetector\Comparator; +use Ergebnis\PHPUnit\SlowTestDetector\Exception; +use Ergebnis\PHPUnit\SlowTestDetector\SlowTest; use PHPUnit\Event; -final class SlowTestReporter +final class Reporter { private Comparator\DurationComparator $durationComparator; diff --git a/test/Unit/SlowTestReporterTest.php b/test/Unit/Reporter/ReporterTest.php similarity index 94% rename from test/Unit/SlowTestReporterTest.php rename to test/Unit/Reporter/ReporterTest.php index d2b50eb7..042b9703 100644 --- a/test/Unit/SlowTestReporterTest.php +++ b/test/Unit/Reporter/ReporterTest.php @@ -11,12 +11,12 @@ * @see https://github.com/ergebnis/phpunit-slow-test-detector */ -namespace Ergebnis\PHPUnit\SlowTestDetector\Test\Unit; +namespace Ergebnis\PHPUnit\SlowTestDetector\Test\Unit\Reporter; use Ergebnis\PHPUnit\SlowTestDetector\Exception; use Ergebnis\PHPUnit\SlowTestDetector\Formatter\ToMillisecondsDurationFormatter; +use Ergebnis\PHPUnit\SlowTestDetector\Reporter\Reporter; use Ergebnis\PHPUnit\SlowTestDetector\SlowTest; -use Ergebnis\PHPUnit\SlowTestDetector\SlowTestReporter; use Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture; use Ergebnis\Test\Util; use PHPUnit\Event; @@ -25,14 +25,14 @@ /** * @internal * - * @covers \Ergebnis\PHPUnit\SlowTestDetector\SlowTestReporter + * @covers \Ergebnis\PHPUnit\SlowTestDetector\Reporter\Reporter * * @uses \Ergebnis\PHPUnit\SlowTestDetector\Comparator\DurationComparator * @uses \Ergebnis\PHPUnit\SlowTestDetector\Exception\MaximumNumberNotGreaterThanZero * @uses \Ergebnis\PHPUnit\SlowTestDetector\Formatter\ToMillisecondsDurationFormatter * @uses \Ergebnis\PHPUnit\SlowTestDetector\SlowTest */ -final class SlowTestReporterTest extends Framework\TestCase +final class ReporterTest extends Framework\TestCase { use Util\Helper; @@ -52,7 +52,7 @@ public function testConstructorRejectsMaximumCountLessThanOne(int $maximumCount) $this->expectException(Exception\MaximumNumberNotGreaterThanZero::class); - new SlowTestReporter( + new Reporter( $durationFormatter, $maximumDuration, $maximumCount @@ -70,13 +70,13 @@ public function testReportReturnsEmptyStringWhenNoSlowTestsHaveBeenSpecified(): ); $maximumCount = $faker->numberBetween(); - $slowTestReporter = new SlowTestReporter( + $reporter = new Reporter( $durationFormatter, $maximumDuration, $maximumCount ); - $report = $slowTestReporter->report(); + $report = $reporter->report(); self::assertSame('', $report); } @@ -152,13 +152,13 @@ public function testReportReturnsReportWhenTheNumberOfSlowTestsIsSmallerThanTheM $maximumNumber = $faker->numberBetween(\count($slowTests) + 1); - $slowTestReporter = new SlowTestReporter( + $reporter = new Reporter( $durationFormatter, $maximumDuration, $maximumNumber ); - $report = $slowTestReporter->report(...$slowTests); + $report = $reporter->report(...$slowTests); $expected = <<<'TXT' Detected 5 tests that took longer than 100 ms. @@ -243,13 +243,13 @@ public function testReportReturnsReportWhenTheNumberOfSlowTestsIsEqualToTheMaxim $maximumNumber = \count($slowTests); - $slowTestReporter = new SlowTestReporter( + $reporter = new Reporter( $durationFormatter, $maximumDuration, $maximumNumber ); - $report = $slowTestReporter->report(...$slowTests); + $report = $reporter->report(...$slowTests); $expected = <<<'TXT' Detected 5 tests that took longer than 100 ms. @@ -334,13 +334,13 @@ public function testReportReturnsReportWhenTheNumberOfSlowTestsIsOneMoreThanTheM $maximumNumber = \count($slowTests) - 1; - $slowTestReporter = new SlowTestReporter( + $reporter = new Reporter( $durationFormatter, $maximumDuration, $maximumNumber ); - $report = $slowTestReporter->report(...$slowTests); + $report = $reporter->report(...$slowTests); $expected = <<<'TXT' Detected 5 tests that took longer than 100 ms. @@ -425,13 +425,13 @@ public function testReportReturnsReportWhenTheNumberOfSlowTestsIsGreaterThanTheM $maximumNumber = \count($slowTests) - 2; - $slowTestReporter = new SlowTestReporter( + $reporter = new Reporter( $durationFormatter, $maximumDuration, $maximumNumber ); - $report = $slowTestReporter->report(...$slowTests); + $report = $reporter->report(...$slowTests); $expected = <<<'TXT' Detected 5 tests that took longer than 100 ms.