Skip to content

Commit 8dd540e

Browse files
committed
PHPUnit upgrade
1 parent 32f2f8e commit 8dd540e

File tree

9 files changed

+25
-25
lines changed

9 files changed

+25
-25
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: 1 addition & 1 deletion
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
}

tests/Logger/Handler/StreamHandlerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function testWriteNonExistingFileResource(): void
142142
public function testWriteNonExistingAndNotCreatablePath(): void
143143
{
144144
$this->expectException('Exception');
145-
$this->expectExceptionMessageMatches('/There is no existing directory at/');
145+
$this->expectExceptionMessageMatchesBC('/There is no existing directory at/');
146146
if (\defined('PHP_WINDOWS_VERSION_BUILD')) {
147147
$this->markTestSkipped('Permissions checks can not run on windows');
148148
}
@@ -157,7 +157,7 @@ public function testWriteNonExistingAndNotCreatablePath(): void
157157
public function testWriteNonExistingAndNotCreatableFileResource(): void
158158
{
159159
$this->expectException('Exception');
160-
$this->expectExceptionMessageMatches('/There is no existing directory at/');
160+
$this->expectExceptionMessageMatchesBC('/There is no existing directory at/');
161161
if (\defined('PHP_WINDOWS_VERSION_BUILD')) {
162162
$this->markTestSkipped('Permissions checks can not run on windows');
163163
}

tests/TestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ abstract class TestCase extends PHPUnitTestCase
1212
/**
1313
* Backwards compatibility for PHPUnit 7.5.
1414
*/
15-
public function expectExceptionMessageMatches(string $regularExpression): void
15+
public function expectExceptionMessageMatchesBC(string $regularExpression): void
1616
{
1717
if (method_exists(PHPUnitTestCase::class, 'expectExceptionMessageMatches')) {
1818
parent::expectExceptionMessageMatches($regularExpression);
@@ -24,7 +24,7 @@ public function expectExceptionMessageMatches(string $regularExpression): void
2424
/**
2525
* Backwards compatibility for PHPUnit 7.5.
2626
*/
27-
public static function assertDirectoryDoesNotExist(string $directory, string $message = ''): void
27+
public static function assertDirectoryDoesNotExistBC(string $directory, string $message = ''): void
2828
{
2929
if (method_exists(PHPUnitTestCase::class, 'assertDirectoryDoesNotExist')) {
3030
parent::assertDirectoryDoesNotExist($directory, $message);

0 commit comments

Comments
 (0)