Skip to content

Commit 6499cd5

Browse files
ISSUE-19: Fix tests
1 parent e59688a commit 6499cd5

11 files changed

+1357
-918
lines changed

composer.lock

+1,327-883
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docker-compose.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
version: '3.8'
2-
31
services:
42
php-cli:
53
build: ./docker/php-cli
64
container_name: phpunit-coverage-tools-php-cli
5+
environment:
6+
- PHP_CS_FIXER_IGNORE_ENV=true
77
volumes:
88
- ./:/var/www/
99
working_dir: /var/www

docker/php-cli/Dockerfile

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
FROM php:8.2-cli
1+
FROM php:8.4-cli
22

33
RUN apt-get update && apt-get install -y zip unzip git curl
44
RUN docker-php-ext-install mysqli pdo pdo_mysql
55

6-
RUN pecl install xdebug \
7-
&& docker-php-ext-enable xdebug
8-
9-
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
10-
11-
COPY ./xdebug.ini "${PHP_INI_DIR}/conf.d"
6+
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer

src/ConsoleOutput.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static function create(): self
4949
}
5050

5151
/**
52-
* @param \RobinIngelbrecht\PHPUnitCoverageTools\MinCoverage\MinCoverageResult[] $results
52+
* @param MinCoverageResult[] $results
5353
*/
5454
public function print(array $results, Duration $duration): void
5555
{
@@ -93,7 +93,7 @@ public function print(array $results, Duration $duration): void
9393
]),
9494
]
9595
),
96-
$result->exitOnLowCoverage() ? 'Yes' : 'No',
96+
$result->exitOnLowCoverage() ? 'Yes' : 'No',
9797
], $results),
9898
new TableSeparator(),
9999
[
@@ -102,9 +102,9 @@ public function print(array $results, Duration $duration): void
102102
[
103103
'colspan' => 5,
104104
'style' => new TableCellStyle([
105-
'align' => 'center',
106-
'cellFormat' => '<'.$finalStatus->value.'>%s</'.$finalStatus->value.'>',
107-
]
105+
'align' => 'center',
106+
'cellFormat' => '<'.$finalStatus->value.'>%s</'.$finalStatus->value.'>',
107+
]
108108
),
109109
]
110110
),

src/MinCoverage/MinCoverageResult.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ private function __construct(
1010
private readonly float $actualMinCoverage,
1111
private readonly int $numberOfTrackedLines,
1212
private readonly int $numberOfCoveredLines,
13-
private readonly bool $exitOnLowCoverage
13+
private readonly bool $exitOnLowCoverage,
1414
) {
1515
}
1616

@@ -54,9 +54,9 @@ public function exitOnLowCoverage(): bool
5454
}
5555

5656
/**
57-
* @param \RobinIngelbrecht\PHPUnitCoverageTools\MinCoverage\CoverageMetric[] $metrics
57+
* @param CoverageMetric[] $metrics
5858
*
59-
* @return \RobinIngelbrecht\PHPUnitCoverageTools\MinCoverage\MinCoverageResult[]
59+
* @return MinCoverageResult[]
6060
*/
6161
public static function mapFromRulesAndMetrics(
6262
MinCoverageRules $minCoverageRules,

src/MinCoverage/MinCoverageRule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ final class MinCoverageRule
99
public function __construct(
1010
private readonly string $pattern,
1111
private readonly int $minCoverage,
12-
private readonly bool $exitOnLowCoverage
12+
private readonly bool $exitOnLowCoverage,
1313
) {
1414
if ($this->minCoverage < 0 || $this->minCoverage > 100) {
1515
throw new \RuntimeException(sprintf('MinCoverage has to be value between 0 and 100. %s given', $this->minCoverage));

src/MinCoverage/MinCoverageRules.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ class MinCoverageRules
1010
public const TOTAL = 'Total';
1111

1212
private function __construct(
13-
/** @var \RobinIngelbrecht\PHPUnitCoverageTools\MinCoverage\MinCoverageRule[] */
14-
private readonly array $rules
13+
/** @var MinCoverageRule[] */
14+
private readonly array $rules,
1515
) {
1616
}
1717

1818
/**
19-
* @return \RobinIngelbrecht\PHPUnitCoverageTools\MinCoverage\MinCoverageRule[]
19+
* @return MinCoverageRule[]
2020
*/
2121
public function getRules(): array
2222
{

src/Timer/SystemResourceUsageFormatter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
final class SystemResourceUsageFormatter implements ResourceUsageFormatter
99
{
1010
private function __construct(
11-
private readonly PhpUnitResourceUsageFormatter $resourceUsageFormatter
11+
private readonly PhpUnitResourceUsageFormatter $resourceUsageFormatter,
1212
) {
1313
}
1414

tests/FixedResourceUsageFormatter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
final class FixedResourceUsageFormatter implements ResourceUsageFormatter
99
{
1010
private function __construct(
11-
private readonly float $usageInMb
11+
private readonly float $usageInMb,
1212
) {
1313
}
1414

tests/PausedTimer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
final class PausedTimer implements Timer
99
{
1010
private function __construct(
11-
private readonly Duration $duration
11+
private readonly Duration $duration,
1212
) {
1313
}
1414

tests/Subscriber/Application/ApplicationFinishedSubscriberTest.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function testNotifyWithAtLeastOneFailedRule(): void
6565
time: HRTime::fromSecondsAndNanoseconds(1, 0),
6666
memoryUsage: MemoryUsage::fromBytes(100),
6767
peakMemoryUsage: MemoryUsage::fromBytes(100),
68-
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, null, null, null, null, null, null, null, null)
68+
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
6969
),
7070
durationSinceStart: Duration::fromSecondsAndNanoseconds(1, 0),
7171
memorySinceStart: MemoryUsage::fromBytes(100),
@@ -99,7 +99,7 @@ public function testNotifyWithAWarning(): void
9999
time: HRTime::fromSecondsAndNanoseconds(1, 0),
100100
memoryUsage: MemoryUsage::fromBytes(100),
101101
peakMemoryUsage: MemoryUsage::fromBytes(100),
102-
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, null, null, null, null, null, null, null, null)
102+
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
103103
),
104104
durationSinceStart: Duration::fromSecondsAndNanoseconds(1, 0),
105105
memorySinceStart: MemoryUsage::fromBytes(100),
@@ -133,7 +133,7 @@ public function testNotifyWhenCoverageIsOk(): void
133133
time: HRTime::fromSecondsAndNanoseconds(1, 0),
134134
memoryUsage: MemoryUsage::fromBytes(100),
135135
peakMemoryUsage: MemoryUsage::fromBytes(100),
136-
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, null, null, null, null, null, null, null, null)
136+
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
137137
),
138138
durationSinceStart: Duration::fromSecondsAndNanoseconds(1, 0),
139139
memorySinceStart: MemoryUsage::fromBytes(100),
@@ -167,7 +167,7 @@ public function testNotifyWithOnlyTotal(): void
167167
time: HRTime::fromSecondsAndNanoseconds(1, 0),
168168
memoryUsage: MemoryUsage::fromBytes(100),
169169
peakMemoryUsage: MemoryUsage::fromBytes(100),
170-
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, null, null, null, null, null, null, null, null)
170+
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
171171
),
172172
durationSinceStart: Duration::fromSecondsAndNanoseconds(1, 0),
173173
memorySinceStart: MemoryUsage::fromBytes(100),
@@ -201,7 +201,7 @@ public function testNotifyWithoutTotal(): void
201201
time: HRTime::fromSecondsAndNanoseconds(1, 0),
202202
memoryUsage: MemoryUsage::fromBytes(100),
203203
peakMemoryUsage: MemoryUsage::fromBytes(100),
204-
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, null, null, null, null, null, null, null, null)
204+
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
205205
),
206206
durationSinceStart: Duration::fromSecondsAndNanoseconds(1, 0),
207207
memorySinceStart: MemoryUsage::fromBytes(100),
@@ -235,7 +235,7 @@ public function testNotifyWithRulesThatDoNotExit(): void
235235
time: HRTime::fromSecondsAndNanoseconds(1, 0),
236236
memoryUsage: MemoryUsage::fromBytes(100),
237237
peakMemoryUsage: MemoryUsage::fromBytes(100),
238-
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, null, null, null, null, null, null, null, null)
238+
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
239239
),
240240
durationSinceStart: Duration::fromSecondsAndNanoseconds(1, 0),
241241
memorySinceStart: MemoryUsage::fromBytes(100),
@@ -269,7 +269,7 @@ public function testDivideByZero(): void
269269
time: HRTime::fromSecondsAndNanoseconds(1, 0),
270270
memoryUsage: MemoryUsage::fromBytes(100),
271271
peakMemoryUsage: MemoryUsage::fromBytes(100),
272-
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, null, null, null, null, null, null, null, null)
272+
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
273273
),
274274
durationSinceStart: Duration::fromSecondsAndNanoseconds(1, 0),
275275
memorySinceStart: MemoryUsage::fromBytes(100),
@@ -303,7 +303,7 @@ public function testNotifyWhenNoTrackedLines(): void
303303
time: HRTime::fromSecondsAndNanoseconds(1, 0),
304304
memoryUsage: MemoryUsage::fromBytes(100),
305305
peakMemoryUsage: MemoryUsage::fromBytes(100),
306-
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, null, null, null, null, null, null, null, null)
306+
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
307307
),
308308
durationSinceStart: Duration::fromSecondsAndNanoseconds(1, 0),
309309
memorySinceStart: MemoryUsage::fromBytes(100),
@@ -337,7 +337,7 @@ public function testNotifyWithNonExistingCloverFile(): void
337337
time: HRTime::fromSecondsAndNanoseconds(1, 0),
338338
memoryUsage: MemoryUsage::fromBytes(100),
339339
peakMemoryUsage: MemoryUsage::fromBytes(100),
340-
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, null, null, null, null, null, null, null, null)
340+
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
341341
),
342342
durationSinceStart: Duration::fromSecondsAndNanoseconds(1, 0),
343343
memorySinceStart: MemoryUsage::fromBytes(100),
@@ -374,7 +374,7 @@ public function testNotifyWithInvalidCloverFile(): void
374374
time: HRTime::fromSecondsAndNanoseconds(1, 0),
375375
memoryUsage: MemoryUsage::fromBytes(100),
376376
peakMemoryUsage: MemoryUsage::fromBytes(100),
377-
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, null, null, null, null, null, null, null, null)
377+
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
378378
),
379379
durationSinceStart: Duration::fromSecondsAndNanoseconds(1, 0),
380380
memorySinceStart: MemoryUsage::fromBytes(100),
@@ -408,7 +408,7 @@ public function testNotifyWithCleanUpCloverFile(): void
408408
time: HRTime::fromSecondsAndNanoseconds(1, 0),
409409
memoryUsage: MemoryUsage::fromBytes(100),
410410
peakMemoryUsage: MemoryUsage::fromBytes(100),
411-
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, null, null, null, null, null, null, null, null)
411+
garbageCollectorStatus: new GarbageCollectorStatus(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
412412
),
413413
durationSinceStart: Duration::fromSecondsAndNanoseconds(1, 0),
414414
memorySinceStart: MemoryUsage::fromBytes(100),

0 commit comments

Comments
 (0)