Skip to content

Commit e74e121

Browse files
committed
PHPUnit 12
1 parent dac2a15 commit e74e121

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+235
-18
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|^9|^10|^11",
27+
"phpunit/phpunit": "^7.5|^8|^9|^10|^11|^12",
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 & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
44
bootstrap="./vendor/autoload.php"
55
colors="true"
66
>
@@ -11,14 +11,6 @@
1111
</testsuite>
1212
</testsuites>
1313

14-
<!-- Old coverage configuration -->
15-
<coverage>
16-
<include>
17-
<directory>./src</directory>
18-
</include>
19-
</coverage>
20-
21-
<!-- PHPUnit 10+ -->
2214
<source>
2315
<include>
2416
<directory>./src</directory>

tests/Analyzer/Cli/ApplicationTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@
44

55
namespace Scheb\Tombstone\Tests\Analyzer\Cli;
66

7+
use PHPUnit\Framework\Attributes\CoversClass;
8+
use PHPUnit\Framework\Attributes\Test;
9+
use Scheb\Tombstone\Analyzer\Cli\AnalyzeCommand;
710
use Scheb\Tombstone\Analyzer\Cli\Application;
811
use Scheb\Tombstone\Tests\DirectoryHelper;
912
use Scheb\Tombstone\Tests\TestCase;
1013
use Symfony\Component\Console\Input\InputInterface;
1114
use Symfony\Component\Console\Output\BufferedOutput;
1215

16+
#[CoversClass(Application::class)]
17+
#[CoversClass(AnalyzeCommand::class)]
1318
class ApplicationTest extends TestCase
1419
{
1520
private const ROOT_DIR = __DIR__.'/../../..';
@@ -53,9 +58,8 @@ protected function tearDown(): void
5358

5459
/**
5560
* @test
56-
* @covers \Scheb\Tombstone\Analyzer\Cli\Application
57-
* @covers \Scheb\Tombstone\Analyzer\Cli\AnalyzeCommand
5861
*/
62+
#[Test]
5963
public function generate_logsAndSourceGiven_createHtmlReport(): void
6064
{
6165
$this->runTestApplication();

tests/Analyzer/Cli/ConsoleOutputTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Scheb\Tombstone\Tests\Analyzer\Cli;
66

7+
use PHPUnit\Framework\Attributes\Test;
78
use PHPUnit\Framework\MockObject\MockObject;
89
use Scheb\Tombstone\Analyzer\Cli\ConsoleOutput;
910
use Scheb\Tombstone\Analyzer\Cli\ConsoleOutputInterface;
@@ -44,6 +45,7 @@ protected function setUp(): void
4445
/**
4546
* @test
4647
*/
48+
#[Test]
4749
public function write_stringGiven_writeToOutput(): void
4850
{
4951
$this->outputInterface
@@ -57,6 +59,7 @@ public function write_stringGiven_writeToOutput(): void
5759
/**
5860
* @test
5961
*/
62+
#[Test]
6063
public function writeln_stringGiven_writeToOutput(): void
6164
{
6265
$this->outputInterface
@@ -70,6 +73,7 @@ public function writeln_stringGiven_writeToOutput(): void
7073
/**
7174
* @test
7275
*/
76+
#[Test]
7377
public function writeln_nothingGiven_writeEmptyLine(): void
7478
{
7579
$this->outputInterface
@@ -83,6 +87,7 @@ public function writeln_nothingGiven_writeEmptyLine(): void
8387
/**
8488
* @test
8589
*/
90+
#[Test]
8691
public function debug_debugEnabled_writeMessage(): void
8792
{
8893
$this->outputInterface
@@ -101,6 +106,7 @@ public function debug_debugEnabled_writeMessage(): void
101106
/**
102107
* @test
103108
*/
109+
#[Test]
104110
public function debug_debugDisabled_writeNothing(): void
105111
{
106112
$this->outputInterface
@@ -118,6 +124,7 @@ public function debug_debugDisabled_writeNothing(): void
118124
/**
119125
* @test
120126
*/
127+
#[Test]
121128
public function createProgressBar_withWidth_returnConfiguredProgressBar(): void
122129
{
123130
$this->outputInterface
@@ -130,6 +137,7 @@ public function createProgressBar_withWidth_returnConfiguredProgressBar(): void
130137
/**
131138
* @test
132139
*/
140+
#[Test]
133141
public function error_debugEnabledNoException_writeOnlyErrorMessage(): void
134142
{
135143
$this->outputInterface
@@ -148,6 +156,7 @@ public function error_debugEnabledNoException_writeOnlyErrorMessage(): void
148156
/**
149157
* @test
150158
*/
159+
#[Test]
151160
public function error_debugDisabledWithException_writeOnlyErrorMessage(): void
152161
{
153162
$this->outputInterface
@@ -166,6 +175,7 @@ public function error_debugDisabledWithException_writeOnlyErrorMessage(): void
166175
/**
167176
* @test
168177
*/
178+
#[Test]
169179
public function error_debugEnabledWithException_writeWithExceptionDetails(): void
170180
{
171181
$this->outputInterface

tests/Analyzer/Config/ConfigurationLoaderTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Scheb\Tombstone\Tests\Analyzer\Config;
66

7+
use PHPUnit\Framework\Attributes\Test;
78
use PHPUnit\Framework\MockObject\MockObject;
89
use Scheb\Tombstone\Analyzer\Config\ConfigProviderInterface;
910
use Scheb\Tombstone\Analyzer\Config\Configuration;
@@ -17,6 +18,7 @@ class ConfigurationLoaderTest extends TestCase
1718
/**
1819
* @test
1920
*/
21+
#[Test]
2022
public function loadConfiguration_multipleProviders_processMergedConfig(): void
2123
{
2224
$provider1 = $this->createProviderReturns(['option1' => ['subNode1' => 'subValue1', 'subNode2' => 'subValue2'], 'option2' => 'value2']);

tests/Analyzer/Config/ConfigurationTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Scheb\Tombstone\Tests\Analyzer\Config;
66

7+
use PHPUnit\Framework\Attributes\Test;
78
use Scheb\Tombstone\Analyzer\Config\Configuration;
89
use Scheb\Tombstone\Tests\TestCase;
910
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
@@ -64,6 +65,7 @@ private function processConfiguration(array $config): array
6465
/**
6566
* @test
6667
*/
68+
#[Test]
6769
public function getConfigTreeBuilder_validFullConfig_returnSameConfig(): void
6870
{
6971
$config = self::FULL_CONFIG;
@@ -76,6 +78,7 @@ public function getConfigTreeBuilder_validFullConfig_returnSameConfig(): void
7678
/**
7779
* @test
7880
*/
81+
#[Test]
7982
public function getConfigTreeBuilder_validMinimumConfig_addDefaultValues(): void
8083
{
8184
$config = self::MINIMUM_CONFIG;
@@ -96,6 +99,7 @@ public function getConfigTreeBuilder_validMinimumConfig_addDefaultValues(): void
9699
/**
97100
* @test
98101
*/
102+
#[Test]
99103
public function getConfigTreeBuilder_additionalConfigValue_isPassedThrough(): void
100104
{
101105
$config = self::FULL_CONFIG;
@@ -109,6 +113,7 @@ public function getConfigTreeBuilder_additionalConfigValue_isPassedThrough(): vo
109113
/**
110114
* @test
111115
*/
116+
#[Test]
112117
public function getConfigTreeBuilder_missingSourceCodeNode_throwsException(): void
113118
{
114119
$config = self::FULL_CONFIG;
@@ -122,6 +127,7 @@ public function getConfigTreeBuilder_missingSourceCodeNode_throwsException(): vo
122127
/**
123128
* @test
124129
*/
130+
#[Test]
125131
public function getConfigTreeBuilder_missingRootDirectory_throwsException(): void
126132
{
127133
$config = self::FULL_CONFIG;
@@ -135,6 +141,7 @@ public function getConfigTreeBuilder_missingRootDirectory_throwsException(): voi
135141
/**
136142
* @test
137143
*/
144+
#[Test]
138145
public function getConfigTreeBuilder_emptyRootDirectory_throwsException(): void
139146
{
140147
$config = self::FULL_CONFIG;
@@ -148,6 +155,7 @@ public function getConfigTreeBuilder_emptyRootDirectory_throwsException(): void
148155
/**
149156
* @test
150157
*/
158+
#[Test]
151159
public function getConfigTreeBuilder_invalidRootDirectory_throwsException(): void
152160
{
153161
$config = self::FULL_CONFIG;
@@ -161,6 +169,7 @@ public function getConfigTreeBuilder_invalidRootDirectory_throwsException(): voi
161169
/**
162170
* @test
163171
*/
172+
#[Test]
164173
public function getConfigTreeBuilder_missingLogNode_throwsException(): void
165174
{
166175
$config = self::FULL_CONFIG;
@@ -174,6 +183,7 @@ public function getConfigTreeBuilder_missingLogNode_throwsException(): void
174183
/**
175184
* @test
176185
*/
186+
#[Test]
177187
public function getConfigTreeBuilder_emptyLogDirectory_throwsException(): void
178188
{
179189
$config = self::FULL_CONFIG;
@@ -188,6 +198,7 @@ public function getConfigTreeBuilder_emptyLogDirectory_throwsException(): void
188198
/**
189199
* @test
190200
*/
201+
#[Test]
191202
public function getConfigTreeBuilder_invalidLogDirectory_throwsException(): void
192203
{
193204
$config = self::FULL_CONFIG;
@@ -202,6 +213,7 @@ public function getConfigTreeBuilder_invalidLogDirectory_throwsException(): void
202213
/**
203214
* @test
204215
*/
216+
#[Test]
205217
public function getConfigTreeBuilder_missingCustomLogProviderClass_throwsException(): void
206218
{
207219
$config = self::FULL_CONFIG;
@@ -216,6 +228,7 @@ public function getConfigTreeBuilder_missingCustomLogProviderClass_throwsExcepti
216228
/**
217229
* @test
218230
*/
231+
#[Test]
219232
public function getConfigTreeBuilder_customLogProviderInvalidFile_throwsException(): void
220233
{
221234
$config = self::FULL_CONFIG;
@@ -230,6 +243,7 @@ public function getConfigTreeBuilder_customLogProviderInvalidFile_throwsExceptio
230243
/**
231244
* @test
232245
*/
246+
#[Test]
233247
public function getConfigTreeBuilder_invalidHtmlReportDirectory_throwsException(): void
234248
{
235249
$config = self::FULL_CONFIG;
@@ -243,6 +257,7 @@ public function getConfigTreeBuilder_invalidHtmlReportDirectory_throwsException(
243257
/**
244258
* @test
245259
*/
260+
#[Test]
246261
public function getConfigTreeBuilder_invalidPhpReportFile_throwsException(): void
247262
{
248263
$config = self::FULL_CONFIG;

tests/Analyzer/Config/YamlConfigProviderTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Scheb\Tombstone\Tests\Analyzer\Config;
66

7+
use PHPUnit\Framework\Attributes\Test;
78
use Scheb\Tombstone\Analyzer\Config\YamlConfigProvider;
89
use Scheb\Tombstone\Tests\TestCase;
910

@@ -21,6 +22,7 @@ protected function readConfiguration(string $file): array
2122
/**
2223
* @test
2324
*/
25+
#[Test]
2426
public function processConfiguration_minimum_haveDirectoriesSet(): void
2527
{
2628
$config = $this->readConfiguration('minimum.yml');
@@ -40,6 +42,7 @@ public function processConfiguration_minimum_haveDirectoriesSet(): void
4042
/**
4143
* @test
4244
*/
45+
#[Test]
4346
public function processConfiguration_fullConfig_haveAllValuesSet(): void
4447
{
4548
$config = $this->readConfiguration('full.yml');

tests/Analyzer/Log/AnalyzerLogFileReaderTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Scheb\Tombstone\Tests\Analyzer\Log;
66

7+
use PHPUnit\Framework\Attributes\Test;
78
use PHPUnit\Framework\MockObject\MockObject;
89
use Scheb\Tombstone\Analyzer\Cli\ConsoleOutputInterface;
910
use Scheb\Tombstone\Analyzer\Log\AnalyzerLogFileReader;
@@ -40,6 +41,7 @@ protected function setUp(): void
4041
/**
4142
* @test
4243
*/
44+
#[Test]
4345
public function readLogFile_fileNotReadable_throwAnalyzerLogProviderException(): void
4446
{
4547
$this->expectException(AnalyzerLogProviderException::class);
@@ -50,6 +52,7 @@ public function readLogFile_fileNotReadable_throwAnalyzerLogProviderException():
5052
/**
5153
* @test
5254
*/
55+
#[Test]
5356
public function readLogFile_invalidLogData_outputErrorReturnValidVampires(): void
5457
{
5558
$this->output
@@ -66,6 +69,7 @@ public function readLogFile_invalidLogData_outputErrorReturnValidVampires(): voi
6669
/**
6770
* @test
6871
*/
72+
#[Test]
6973
public function readLogFile_allValidData_returnVampires(): void
7074
{
7175
$this->output

tests/Analyzer/Log/AnalyzerLogProviderTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Scheb\Tombstone\Tests\Analyzer\Log;
66

7+
use PHPUnit\Framework\Attributes\Test;
78
use PHPUnit\Framework\MockObject\MockObject;
89
use Scheb\Tombstone\Analyzer\Cli\ConsoleOutputInterface;
910
use Scheb\Tombstone\Analyzer\Cli\ProgressBar;
@@ -39,6 +40,7 @@ protected function setUp(): void
3940
/**
4041
* @test
4142
*/
43+
#[Test]
4244
public function iterateVampires_fixtureDirectoryGiven_yieldVampiresFromAllLogFiles(): void
4345
{
4446
$vampire1 = $this->createMock(Vampire::class);
@@ -67,6 +69,7 @@ public function iterateVampires_fixtureDirectoryGiven_yieldVampiresFromAllLogFil
6769
/**
6870
* @test
6971
*/
72+
#[Test]
7073
public function iterateVampires_fixtureDirectoryGiven_advanceProgressBarForEachFile(): void
7174
{
7275
$this->logFileReader

tests/Analyzer/Log/LogCollectorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Scheb\Tombstone\Tests\Analyzer\Log;
66

7+
use PHPUnit\Framework\Attributes\Test;
78
use Scheb\Tombstone\Analyzer\Log\LogCollector;
89
use Scheb\Tombstone\Analyzer\Log\LogProviderInterface;
910
use Scheb\Tombstone\Analyzer\Model\VampireIndex;
@@ -27,6 +28,7 @@ private function createProvider(array $vampires): LogProviderInterface
2728
/**
2829
* @test
2930
*/
31+
#[Test]
3032
public function collectLogs_multipleProviders_addVampiresFromEachProviderToIndex(): void
3133
{
3234
$vampire1 = $this->createMock(Vampire::class);

0 commit comments

Comments
 (0)