Skip to content

Commit 712b103

Browse files
committed
PHPUnit upgrade
1 parent 32f2f8e commit 712b103

21 files changed

+121
-49
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",

phpunit.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<testsuites>
88
<testsuite name="Test suite">
99
<directory suffix="Test.php">./tests</directory>
10+
<exclude>./tests/Analyzer/Matching/AbstractMatchingStrategyTest.php</exclude>
1011
</testsuite>
1112
</testsuites>
1213

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/Cli/ConsoleOutputTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Scheb\Tombstone\Analyzer\Cli\ConsoleOutput;
99
use Scheb\Tombstone\Analyzer\Cli\ConsoleOutputInterface;
1010
use Scheb\Tombstone\Tests\TestCase;
11+
use Scheb\Tombstone\Tests\WithConsecutive;
1112
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
1213
use Symfony\Component\Console\Output\OutputInterface;
1314

@@ -175,10 +176,10 @@ public function error_debugEnabledWithException_writeWithExceptionDetails(): voi
175176
$this->outputInterface
176177
->expects($this->exactly(2))
177178
->method('writeln')
178-
->withConsecutive(
179+
->with(...WithConsecutive::create(
179180
['<error>error message</error>'],
180181
[$this->matches('Exception: exception message at %s'.DIRECTORY_SEPARATOR.'ConsoleOutputTest.php line %i')]
181-
);
182+
));
182183

183184
$this->consoleOutput->error('error message', new \Exception('exception message'));
184185
}

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/Log/LogCollectorTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Scheb\Tombstone\Analyzer\Model\VampireIndex;
1010
use Scheb\Tombstone\Core\Model\Vampire;
1111
use Scheb\Tombstone\Tests\TestCase;
12+
use Scheb\Tombstone\Tests\WithConsecutive;
1213

1314
class LogCollectorTest extends TestCase
1415
{
@@ -39,11 +40,11 @@ public function collectLogs_multipleProviders_addVampiresFromEachProviderToIndex
3940
$vampireIndex
4041
->expects($this->exactly(3))
4142
->method('addVampire')
42-
->withConsecutive(
43+
->with(...WithConsecutive::create(
4344
[$this->identicalTo($vampire1)],
4445
[$this->identicalTo($vampire2)],
4546
[$this->identicalTo($vampire3)]
46-
);
47+
));
4748

4849
$collector = new LogCollector([$provider1, $provider2], $vampireIndex);
4950
$collector->collectLogs();

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'],

0 commit comments

Comments
 (0)