Skip to content

Commit 516d803

Browse files
committed
Fix: Rename MaximumCount to Count
1 parent 070e1f8 commit 516d803

File tree

7 files changed

+21
-19
lines changed

7 files changed

+21
-19
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ For a full diff see [`2.3.2...main`][2.3.2...main].
1212

1313
- Extracted `Duration` ([#351]), by [@localheinz]
1414
- Merged `MaximumDuration` into `Duration` ([#352]), by [@localheinz]
15+
- Renamed `MaximumCount` to `Count` ([#353]), by [@localheinz]
1516

1617
### Fixed
1718

@@ -176,5 +177,6 @@ For a full diff see [`7afa59c...1.0.0`][7afa59c...1.0.0].
176177
[#350]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/350
177178
[#351]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/351
178179
[#352]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/352
180+
[#353]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/353
179181

180182
[@localheinz]: https://github.com/localheinz

src/MaximumCount.php renamed to src/Count.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
/**
1717
* @internal
1818
*/
19-
final class MaximumCount
19+
final class Count
2020
{
2121
private function __construct(private readonly int $value)
2222
{
2323
}
2424

2525
/**
26-
* @throws Exception\InvalidMaximumCount
26+
* @throws Exception\InvalidCount
2727
*/
2828
public static function fromInt(int $value): self
2929
{
3030
if (0 >= $value) {
31-
throw Exception\InvalidMaximumCount::notGreaterThanZero($value);
31+
throw Exception\InvalidCount::notGreaterThanZero($value);
3232
}
3333

3434
return new self($value);

src/Exception/InvalidMaximumCount.php renamed to src/Exception/InvalidCount.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* @internal
1818
*/
19-
final class InvalidMaximumCount extends \InvalidArgumentException
19+
final class InvalidCount extends \InvalidArgumentException
2020
{
2121
public static function notGreaterThanZero(int $value): self
2222
{

src/Extension.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ public function bootstrap(
2727
return;
2828
}
2929

30-
$maximumCount = MaximumCount::fromInt(10);
30+
$maximumCount = Count::fromInt(10);
3131

3232
if ($parameters->has('maximum-count')) {
33-
$maximumCount = MaximumCount::fromInt((int) $parameters->get('maximum-count'));
33+
$maximumCount = Count::fromInt((int) $parameters->get('maximum-count'));
3434
}
3535

3636
$maximumDuration = Duration::fromMilliseconds(500);

src/Reporter/DefaultReporter.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
namespace Ergebnis\PHPUnit\SlowTestDetector\Reporter;
1515

1616
use Ergebnis\PHPUnit\SlowTestDetector\Comparator;
17+
use Ergebnis\PHPUnit\SlowTestDetector\Count;
1718
use Ergebnis\PHPUnit\SlowTestDetector\Duration;
1819
use Ergebnis\PHPUnit\SlowTestDetector\Formatter;
19-
use Ergebnis\PHPUnit\SlowTestDetector\MaximumCount;
2020
use Ergebnis\PHPUnit\SlowTestDetector\SlowTest;
2121

2222
/**
@@ -29,7 +29,7 @@ final class DefaultReporter implements Reporter
2929
public function __construct(
3030
private readonly Formatter\DurationFormatter $durationFormatter,
3131
private readonly Duration $maximumDuration,
32-
private readonly MaximumCount $maximumCount,
32+
private readonly Count $maximumCount,
3333
) {
3434
$this->durationComparator = new Comparator\DurationComparator();
3535
}

test/Unit/MaximumCountTest.php renamed to test/Unit/CountTest.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,27 @@
1414
namespace Ergebnis\PHPUnit\SlowTestDetector\Test\Unit;
1515

1616
use Ergebnis\DataProvider;
17+
use Ergebnis\PHPUnit\SlowTestDetector\Count;
1718
use Ergebnis\PHPUnit\SlowTestDetector\Exception;
18-
use Ergebnis\PHPUnit\SlowTestDetector\MaximumCount;
1919
use PHPUnit\Framework;
2020

21-
#[Framework\Attributes\CoversClass(MaximumCount::class)]
22-
#[Framework\Attributes\UsesClass(Exception\InvalidMaximumCount::class)]
23-
final class MaximumCountTest extends Framework\TestCase
21+
#[Framework\Attributes\CoversClass(Count::class)]
22+
#[Framework\Attributes\UsesClass(Exception\InvalidCount::class)]
23+
final class CountTest extends Framework\TestCase
2424
{
2525
#[Framework\Attributes\DataProviderExternal(DataProvider\IntProvider::class, 'lessThanZero')]
2626
#[Framework\Attributes\DataProviderExternal(DataProvider\IntProvider::class, 'zero')]
2727
public function testFromIntRejectsInvalidValue(int $value): void
2828
{
29-
$this->expectException(Exception\InvalidMaximumCount::class);
29+
$this->expectException(Exception\InvalidCount::class);
3030

31-
MaximumCount::fromInt($value);
31+
Count::fromInt($value);
3232
}
3333

3434
#[Framework\Attributes\DataProviderExternal(DataProvider\IntProvider::class, 'greaterThanZero')]
35-
public function testFromSecondsReturnsMaximumCount(int $value): void
35+
public function testFromIntReturnsCount(int $value): void
3636
{
37-
$maximumCount = MaximumCount::fromInt($value);
37+
$maximumCount = Count::fromInt($value);
3838

3939
self::assertSame($value, $maximumCount->toInt());
4040
}

test/Unit/Exception/InvalidMaximumCountTest.php renamed to test/Unit/Exception/InvalidCountTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
use Ergebnis\PHPUnit\SlowTestDetector\Test;
1818
use PHPUnit\Framework;
1919

20-
#[Framework\Attributes\CoversClass(Exception\InvalidMaximumCount::class)]
21-
final class InvalidMaximumCountTest extends Framework\TestCase
20+
#[Framework\Attributes\CoversClass(Exception\InvalidCount::class)]
21+
final class InvalidCountTest extends Framework\TestCase
2222
{
2323
use Test\Util\Helper;
2424

2525
public function testNotGreaterThanZeroReturnsException(): void
2626
{
2727
$value = self::faker()->numberBetween();
2828

29-
$exception = Exception\InvalidMaximumCount::notGreaterThanZero($value);
29+
$exception = Exception\InvalidCount::notGreaterThanZero($value);
3030

3131
$message = \sprintf(
3232
'Value should be greater than 0, but %d is not.',

0 commit comments

Comments
 (0)