Skip to content

Commit d1826f5

Browse files
committed
PHPUnit upgrade
1 parent 32f2f8e commit d1826f5

File tree

15 files changed

+41
-41
lines changed

15 files changed

+41
-41
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"require-dev": {
2626
"escapestudios/symfony2-coding-standard": "^3.9",
27-
"phpunit/phpunit": "^7.5|^8.0|^9.0",
27+
"phpunit/phpunit": "^7.5|^8|^9|^10|^11",
2828
"squizlabs/php_codesniffer": "^3.5",
2929
"symfony/css-selector": "^4.4|^5.0|^6.0|^7.0|^8.0",
3030
"symfony/dom-crawler": "^4.4|^5.0|^6.0|^7.0|^8.0",

src/analyzer/Report/Html/Renderer/DashboardRenderer.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ public function generate(AnalyzerResult $result): void
7979
$this->dashboardTemplate->setVar([
8080
'path_to_root' => '',
8181
'date' => date('r'),
82-
'tombstones_count' => $total,
83-
'dead_count' => $numDead,
84-
'undead_count' => $numUndead,
85-
'deleted_count' => $numDeleted,
86-
'dead_percent' => $deadPercent,
87-
'undead_percent' => $undeadPercent,
82+
'tombstones_count' => (string) $total,
83+
'dead_count' => (string) $numDead,
84+
'undead_count' => (string) $numUndead,
85+
'deleted_count' => (string) $numDeleted,
86+
'dead_percent' => (string) $deadPercent,
87+
'undead_percent' => (string) $undeadPercent,
8888
'tombstones_view' => $tombstonesView,
8989
'deleted_view' => $deletedView,
9090
]);
@@ -114,7 +114,7 @@ private function renderDeadTombstones(AnalyzerFileResult $fileResult): string
114114
$this->deadTemplate->setVar([
115115
'path_to_root' => '',
116116
'tombstone' => $this->linkToTombstoneInCode((string) $tombstone, $fileResult->getFile(), $tombstone->getLine()),
117-
'line' => $tombstone->getLine(),
117+
'line' => (string) $tombstone->getLine(),
118118
'scope' => $this->getTombstoneScope($tombstone),
119119
'dead_since' => $this->getDeadSince($tombstone),
120120
]);
@@ -146,7 +146,7 @@ private function renderUndeadTombstones(AnalyzerFileResult $fileResult): string
146146
$this->undeadTemplate->setVar([
147147
'path_to_root' => '',
148148
'tombstone' => $this->linkToTombstoneInCode((string) $tombstone, $fileResult->getFile(), $tombstone->getLine()),
149-
'line' => $tombstone->getLine(),
149+
'line' => (string) $tombstone->getLine(),
150150
'scope' => $this->getTombstoneScope($tombstone),
151151
'invocation' => $this->renderInvokers($tombstone),
152152
]);
@@ -206,7 +206,7 @@ private function renderDeletedTombstones(AnalyzerFileResult $fileResult): string
206206
$this->deletedTemplate->setVar([
207207
'path_to_root' => './',
208208
'tombstone' => htmlspecialchars((string) $vampire->getTombstone()),
209-
'line' => $vampire->getLine(),
209+
'line' => (string) $vampire->getLine(),
210210
'scope' => $this->getTombstoneScope($vampire->getTombstone()),
211211
'last_call' => $this->getLastCalled($vampire),
212212
]);

src/analyzer/Report/Html/Renderer/DirectoryItemRenderer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ public function renderDirectoryItem(string $name, string $link, ResultAggregateI
4040
'link' => $link,
4141
'class' => $this->getClass($undeadCount, $totalCount),
4242
'bar' => $this->renderBar($deadCount, $totalCount),
43-
'total' => $totalCount,
44-
'numDead' => $deadCount,
45-
'numUndead' => $undeadCount,
43+
'total' => (string) $totalCount,
44+
'numDead' => (string) $deadCount,
45+
'numUndead' => (string) $undeadCount,
4646
]);
4747

4848
return $this->directoryItemTemplate->render();
@@ -66,7 +66,7 @@ private function renderBar(int $numDead, int $total): string
6666
{
6767
$this->barTemplate->setVar([
6868
'level' => 'success',
69-
'percent' => round((float) $numDead / (float) $total * 100.0, 2),
69+
'percent' => (string) round((float) $numDead / (float) $total * 100.0, 2),
7070
]);
7171

7272
return $this->barTemplate->render();

src/analyzer/Report/Html/Renderer/FileSourceCodeRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ private function renderCodeLine(string $class, int $lineNumber, string $codeLine
6060
{
6161
$this->sourceCodeTemplate->setVar([
6262
'class' => $class,
63-
'line' => $lineNumber,
63+
'line' => (string) $lineNumber,
6464
'code' => $codeLine,
6565
]);
6666

src/analyzer/Report/Html/Renderer/FileTombstoneListRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ private function renderTombstoneItem(Tombstone $tombstone, string $class): strin
4545
{
4646
$this->tombstoneTemplate->setVar([
4747
'tombstone' => htmlspecialchars((string) $tombstone),
48-
'line' => $tombstone->getLine(),
48+
'line' => (string) $tombstone->getLine(),
4949
'method' => htmlspecialchars($tombstone->getMethod() ?? ''),
5050
'level' => $class,
5151
]);

tests/Analyzer/Config/ConfigurationTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function getConfigTreeBuilder_missingSourceCodeNode_throwsException(): vo
115115
unset($config['source_code']);
116116

117117
$this->expectException(InvalidConfigurationException::class);
118-
$this->expectExceptionMessageMatches('/"source_code".*must be configured/');
118+
$this->expectExceptionMessageMatchesBC('/"source_code".*must be configured/');
119119
$this->processConfiguration($config);
120120
}
121121

@@ -128,7 +128,7 @@ public function getConfigTreeBuilder_missingRootDirectory_throwsException(): voi
128128
unset($config['source_code']['root_directory']);
129129

130130
$this->expectException(InvalidConfigurationException::class);
131-
$this->expectExceptionMessageMatches('/"root_directory".*must be configured/');
131+
$this->expectExceptionMessageMatchesBC('/"root_directory".*must be configured/');
132132
$this->processConfiguration($config);
133133
}
134134

@@ -167,7 +167,7 @@ public function getConfigTreeBuilder_missingLogNode_throwsException(): void
167167
unset($config['logs']);
168168

169169
$this->expectException(InvalidConfigurationException::class);
170-
$this->expectExceptionMessageMatches('/"logs".*must be configured/');
170+
$this->expectExceptionMessageMatchesBC('/"logs".*must be configured/');
171171
$this->processConfiguration($config);
172172
}
173173

@@ -209,7 +209,7 @@ public function getConfigTreeBuilder_missingCustomLogProviderClass_throwsExcepti
209209
unset($config['logs']['custom']['class']);
210210

211211
$this->expectException(InvalidConfigurationException::class);
212-
$this->expectExceptionMessageMatches('/"class".*must be configured/');
212+
$this->expectExceptionMessageMatchesBC('/"class".*must be configured/');
213213
$this->processConfiguration($config);
214214
}
215215

tests/Analyzer/Report/FileSystemTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function copyDirectoryFiles_targetIsWritable_copyAllFiles(): void
5858
*/
5959
public function ensureDirectoryCreated_directoryAlreadyCreated_doNothing(): void
6060
{
61-
$this->assertDirectoryDoesNotExist(self::TEST_DIRECTORY);
61+
$this->assertDirectoryDoesNotExistBC(self::TEST_DIRECTORY);
6262
FileSystem::ensureDirectoryCreated(self::TEST_DIRECTORY);
6363
$this->assertDirectoryExists(self::TEST_DIRECTORY);
6464
}
@@ -92,7 +92,7 @@ public function createPath_parentAndNameGiven_returnConcatenatedPath(string $par
9292
$this->assertEquals($expectedResult, FileSystem::createPath($parent, $name));
9393
}
9494

95-
public function getTestCasesForCreatePath(): array
95+
public static function getTestCasesForCreatePath(): array
9696
{
9797
return [
9898
'root' => ['/root', 'name', DIRECTORY_SEPARATOR.'root'.DIRECTORY_SEPARATOR.'name'],

tests/Analyzer/Report/TimePeriodFormatterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function formatAge_dateGiven_returnFormattedTimePeriod(string $date, stri
2727
$this->assertEquals($expectedFormattedPeriod, $returnValue);
2828
}
2929

30-
public function getFormatDateTestCases(): array
30+
public static function getFormatDateTestCases(): array
3131
{
3232
$fewHoursDate = date('Y-m-d', strtotime('-6 hours'));
3333
$daysDate = date('Y-m-d', strtotime('-5 days'));

tests/Core/Model/RootPathTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function getAbsolutePath_denormalizedPathGiven_returnNormalizedPath(strin
3232
$this->assertEquals($normalizedPath, $rootPath->getAbsolutePath());
3333
}
3434

35-
public function provideDenormalizedPaths(): array
35+
public static function provideDenormalizedPaths(): array
3636
{
3737
return [
3838
['/path/to/test', '/path/to/test/'],
@@ -77,7 +77,7 @@ public function getReferencePath_rootPathGiven_returnAbsolutePath(): void
7777
$this->assertEquals('/path/missing/slash/', $rootPath->getReferencePath());
7878
}
7979

80-
public function provideRelativePathTestCases(): array
80+
public static function provideRelativePathTestCases(): array
8181
{
8282
return [
8383
['/path/to', '/path/to/directory/file.php', '/path/to/directory/file.php'],
@@ -107,7 +107,7 @@ public function createFilePath_pathOutsideRoot_returnAbsoluteFilePath(string $ro
107107
$this->assertEquals($expectedAbsolutePath, $returnValue->getReferencePath());
108108
}
109109

110-
public function provideRelativePathNotPossible(): array
110+
public static function provideRelativePathNotPossible(): array
111111
{
112112
return [
113113
['/other/base', '/path/to/file.php', '/path/to/file.php'],
@@ -130,7 +130,7 @@ public function createFilePath_relativePathGiven_generateAbsolutePath(string $ro
130130
$this->assertEquals($expectedAbsolutePath, $returnValue->getAbsolutePath());
131131
}
132132

133-
public function provideRelativePaths(): array
133+
public static function provideRelativePaths(): array
134134
{
135135
return [
136136
['/root/path', '', '/root/path/'],

tests/Core/Model/TombstoneTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class TombstoneTest extends TestCase
1414
{
1515
private const ROOT_DIR = '/path/to';
1616

17-
private function createTombstone(string $file, string ...$arguments): Tombstone
17+
private static function createTombstone(string $file, string ...$arguments): Tombstone
1818
{
1919
$rootPath = new RootPath(self::ROOT_DIR);
2020

@@ -90,12 +90,12 @@ public function inscriptionEquals_differentInscription_returnFalse(Tombstone $to
9090
$this->assertFalse($result);
9191
}
9292

93-
public function provideTombstonesToCompare(): array
93+
public static function provideTombstonesToCompare(): array
9494
{
95-
$reference = $this->createTombstone('file', '2015-01-01', 'author', 'label');
96-
$tombstone1 = $this->createTombstone('file', '2015-01-02', 'author', 'label');
97-
$tombstone2 = $this->createTombstone('file', '2015-01-01', 'otherAuthor', 'label');
98-
$tombstone3 = $this->createTombstone('file', '2015-01-01', 'author', 'otherLabel');
95+
$reference = self::createTombstone('file', '2015-01-01', 'author', 'label');
96+
$tombstone1 = self::createTombstone('file', '2015-01-02', 'author', 'label');
97+
$tombstone2 = self::createTombstone('file', '2015-01-01', 'otherAuthor', 'label');
98+
$tombstone3 = self::createTombstone('file', '2015-01-01', 'author', 'otherLabel');
9999

100100
return [
101101
[$reference, $tombstone1],

0 commit comments

Comments
 (0)