Skip to content

Commit

Permalink
Merge pull request #20 from ergebnis/feature/rename
Browse files Browse the repository at this point in the history
Enhancement: Rename SlowTestReporter to Reporter\Reporter
  • Loading branch information
ergebnis-bot authored Jan 24, 2021
2 parents 612f544 + 60fce9c commit 954f3a2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
7 changes: 5 additions & 2 deletions src/SlowTestReporter.php → src/Reporter/Reporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand All @@ -52,7 +52,7 @@ public function testConstructorRejectsMaximumCountLessThanOne(int $maximumCount)

$this->expectException(Exception\MaximumNumberNotGreaterThanZero::class);

new SlowTestReporter(
new Reporter(
$durationFormatter,
$maximumDuration,
$maximumCount
Expand All @@ -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);
}
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 954f3a2

Please sign in to comment.