Skip to content

Commit e42bfda

Browse files
committed
Update phpunit
1 parent 3e5e2f6 commit e42bfda

4 files changed

Lines changed: 360 additions & 381 deletions

File tree

Tests/Tests.php

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
declare(strict_types=1);
33

4+
use PHPUnit\Framework\Attributes\DataProvider;
45
use xPaw\SourceQuery\BaseSocket;
56
use xPaw\SourceQuery\SourceQuery;
67
use xPaw\SourceQuery\Buffer;
@@ -110,9 +111,6 @@ public function testNotConnectedGetPlayers() : void
110111
$this->SourceQuery->GetPlayers();
111112
}
112113

113-
/**
114-
* @expectedException xPaw\SourceQuery\Exception\SocketException
115-
*/
116114
public function testNotConnectedGetRules() : void
117115
{
118116
$this->expectException( xPaw\SourceQuery\Exception\SocketException::class );
@@ -140,9 +138,7 @@ public function testRconWithoutPassword() : void
140138
$this->SourceQuery->Rcon('a');
141139
}
142140

143-
/**
144-
* @dataProvider InfoProvider
145-
*/
141+
#[DataProvider( 'InfoProvider' )]
146142
public function testGetInfo( string $RawInput, array $ExpectedOutput ) : void
147143
{
148144
if( isset( $ExpectedOutput[ 'IsMod' ] ) )
@@ -180,9 +176,7 @@ public static function InfoProvider() : array
180176
return $DataProvider;
181177
}
182178

183-
/**
184-
* @dataProvider BadPacketProvider
185-
*/
179+
#[DataProvider( 'BadPacketProvider' )]
186180
public function testBadGetInfo( string $Data ) : void
187181
{
188182
$this->expectException( xPaw\SourceQuery\Exception\InvalidPacketException::class );
@@ -191,9 +185,7 @@ public function testBadGetInfo( string $Data ) : void
191185
$this->SourceQuery->GetInfo();
192186
}
193187

194-
/**
195-
* @dataProvider BadPacketProvider
196-
*/
188+
#[DataProvider( 'BadPacketProvider' )]
197189
public function testBadGetChallengeViaPlayers( string $Data ) : void
198190
{
199191
$this->expectException( xPaw\SourceQuery\Exception\InvalidPacketException::class );
@@ -202,9 +194,7 @@ public function testBadGetChallengeViaPlayers( string $Data ) : void
202194
$this->SourceQuery->GetPlayers();
203195
}
204196

205-
/**
206-
* @dataProvider BadPacketProvider
207-
*/
197+
#[DataProvider( 'BadPacketProvider' )]
208198
public function testBadGetPlayersAfterCorrectChallenge( string $Data ) : void
209199
{
210200
$this->expectException( xPaw\SourceQuery\Exception\InvalidPacketException::class );
@@ -214,9 +204,7 @@ public function testBadGetPlayersAfterCorrectChallenge( string $Data ) : void
214204
$this->SourceQuery->GetPlayers();
215205
}
216206

217-
/**
218-
* @dataProvider BadPacketProvider
219-
*/
207+
#[DataProvider( 'BadPacketProvider' )]
220208
public function testBadGetRulesAfterCorrectChallenge( string $Data ) : void
221209
{
222210
$this->expectException( xPaw\SourceQuery\Exception\InvalidPacketException::class );
@@ -250,10 +238,8 @@ public function testGetChallengeTwice( ) : void
250238
self::assertEquals( [ 'wow' => 'much' ], $this->SourceQuery->GetRules() );
251239
}
252240

253-
/**
254-
* @dataProvider RulesProvider
255-
* @param array<string> $RawInput
256-
*/
241+
/** @param array<string> $RawInput */
242+
#[DataProvider( 'RulesProvider' )]
257243
public function testGetRules( array $RawInput, array $ExpectedOutput ) : void
258244
{
259245
$this->Socket->Queue( (string)hex2bin( "ffffffff4104fce20e" ) ); // Challenge
@@ -291,10 +277,8 @@ public static function RulesProvider() : array
291277
return $DataProvider;
292278
}
293279

294-
/**
295-
* @dataProvider PlayersProvider
296-
* @param array<string> $RawInput
297-
*/
280+
/** @param array<string> $RawInput */
281+
#[DataProvider( 'PlayersProvider' )]
298282
public function testGetPlayers( array $RawInput, array $ExpectedOutput ) : void
299283
{
300284
$this->Socket->Queue( (string)hex2bin( "ffffffff4104fce20e" ) ); // Challenge

Tests/phpunit.xml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" cacheDirectory=".phpunit.cache">
3-
<coverage>
4-
<report>
5-
<clover outputFile="../build/logs/clover.xml"/>
6-
</report>
7-
</coverage>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.0/phpunit.xsd" cacheDirectory=".phpunit.cache">
83
<testsuites>
94
<testsuite name="Tests">
105
<file>./Tests.php</file>
116
</testsuite>
127
</testsuites>
13-
<logging/>
148
<source>
159
<include>
1610
<directory suffix=".php">../SourceQuery</directory>

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,16 @@
3030
"@phpstan"
3131
],
3232
"phpunit": "phpunit --configuration Tests/phpunit.xml --fail-on-warning",
33+
"phpunit:coverage": "phpunit --configuration Tests/phpunit.xml --fail-on-warning --coverage-clover build/logs/clover.xml",
3334
"phpstan": "phpstan"
3435
},
3536
"require":
3637
{
37-
"php": ">=8.1"
38+
"php": ">=8.2"
3839
},
3940
"require-dev":
4041
{
41-
"phpunit/phpunit": "^10.3",
42+
"phpunit/phpunit": "^12.0",
4243
"phpstan/phpstan": "^2.0",
4344
"phpstan/phpstan-strict-rules": "^2.0"
4445
},

0 commit comments

Comments
 (0)