Skip to content

Commit 2842100

Browse files
committed
upgrade phpunit/phpunit (9.6.34 => 12.5.14) & phpunit/php-code-coverage (9.2.32 => 12.5.3)
1 parent 15d114b commit 2842100

File tree

9 files changed

+55
-65
lines changed

9 files changed

+55
-65
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
- update PHP versions to run on PHP 8.5
1010
- update symfony/dotenv (v5.4.48 => v7.4.0)
1111
- upgrade vimeo/psalm (4.30.0 = => 6.15.1)
12+
- upgrade phpunit/php-code-coverage (9.2.32 => 12.5.3)
13+
- upgrade phpunit/phpunit (9.6.34 => 12.5.14)
1214

1315
### Removed
1416
- removed support PHP 8.0

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
"ext-json": "*"
99
},
1010
"require-dev": {
11-
"phpunit/phpunit": "^9.6",
11+
"phpunit/phpunit": "^12",
1212
"symfony/dotenv": "^7.4",
1313
"friendsofphp/php-cs-fixer": "^3.94",
1414
"phpmd/phpmd": "^2.6",
1515
"php-coveralls/php-coveralls": "^2.9",
1616
"php-mock/php-mock-phpunit": "^2.15",
1717
"vimeo/psalm": "^6.0",
18-
"phpunit/php-code-coverage": "^9.2"
18+
"phpunit/php-code-coverage": "^12"
1919
},
2020
"autoload": {
2121
"psr-4": {

phpunit.xml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
43
colors="true"
54
failOnRisky="true"
65
failOnWarning="true"
76
stopOnFailure="false">
87
<testsuites>
98
<testsuite name="Pricehubble Test Suite">
109
<directory suffix=".php">./tests/</directory>
10+
<exclude>./tests/Traits/</exclude>
1111
</testsuite>
1212
</testsuites>
13-
<logging>
14-
<log type="coverage-clover" target="./build/logs/clover.xml"/>
15-
<log type="coverage-html" target="./build/logs/coverage-html"/>
16-
</logging>
17-
<filter>
18-
<whitelist processUncoveredFilesFromWhitelist="true">
13+
<source>
14+
<include>
1915
<directory suffix=".php">src</directory>
20-
</whitelist>
21-
</filter>
16+
</include>
17+
</source>
18+
<coverage>
19+
<report>
20+
<clover outputFile="./build/logs/clover.xml"/>
21+
<html outputDirectory="./build/logs/coverage-html"/>
22+
</report>
23+
</coverage>
2224
<php>
2325
<!-- Temporarily preventing https://github.com/xdebug/xdebug/pull/699 -->
2426
<const name="XDEBUG_CC_UNUSED" value=""/>
2527
<const name="XDEBUG_CC_DEAD_CODE" value="-1"/>
2628
</php>
27-
</phpunit>
29+
</phpunit>

tests/Unit/AbstractResourceTest.php

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,36 @@
44

55
use Antistatique\Pricehubble\Pricehubble;
66
use Antistatique\Pricehubble\Resource\AbstractResource;
7+
use PHPUnit\Framework\Attributes\CoversClass;
8+
use PHPUnit\Framework\Attributes\CoversMethod;
9+
use PHPUnit\Framework\Attributes\Group;
710
use PHPUnit\Framework\TestCase;
811

912
/**
10-
* @coversDefaultClass \Antistatique\Pricehubble\Resource\AbstractResource
11-
*
12-
* @group pricehubble
13-
* @group pricehubble_unit
14-
*
1513
* @internal
1614
*/
15+
#[CoversClass(AbstractResource::class)]
16+
#[CoversMethod(AbstractResource::class, '__construct')]
17+
#[CoversMethod(AbstractResource::class, 'setPricehubble')]
18+
#[CoversMethod(AbstractResource::class, 'getPricehubble')]
19+
#[Group('pricehubble')]
20+
#[Group('pricehubble_unit')]
1721
final class AbstractResourceTest extends TestCase
1822
{
19-
/**
20-
* @covers ::__construct
21-
*/
2223
public function testConstructorArgumentCount(): void
2324
{
2425
$this->expectException(\ArgumentCountError::class);
2526
new class extends AbstractResource {};
2627
}
2728

28-
/**
29-
* @covers ::__construct
30-
*/
3129
public function testConstructor(): void
3230
{
3331
$pricehubble = new Pricehubble();
3432
// Get mock, without the constructor being called
3533
$mock = $this->getMockBuilder(AbstractResource::class)
3634
->disableOriginalConstructor()
3735
->onlyMethods(['setPricehubble'])
38-
->getMockForAbstractClass();
36+
->getMock();
3937

4038
// Set expectations for constructor calls.
4139
$mock->expects($this->once())
@@ -48,26 +46,16 @@ public function testConstructor(): void
4846
$constructor->invoke($mock, $pricehubble);
4947
}
5048

51-
/**
52-
* @covers ::setPricehubble
53-
*/
5449
public function testSetPricehubbleReturnsExpected(): void
5550
{
5651
$pricehubble = new Pricehubble();
52+
$testResource = new class(new Pricehubble()) extends AbstractResource {};
5753

58-
// Get mock, without the constructor being called
59-
$mock = $this->getMockBuilder(AbstractResource::class)
60-
->disableOriginalConstructor()
61-
->getMockForAbstractClass();
62-
63-
$mock->setPricehubble($pricehubble);
64-
$result = $mock->getPricehubble();
54+
$testResource->setPricehubble($pricehubble);
55+
$result = $testResource->getPricehubble();
6556
self::assertSame($result, $pricehubble);
6657
}
6758

68-
/**
69-
* @covers ::getPricehubble
70-
*/
7159
public function testGetPricehubbleReturnsExpected(): void
7260
{
7361
$pricehubble = new Pricehubble();

tests/Unit/CurlAvailabilitiesTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@
44

55
use Antistatique\Pricehubble\Pricehubble;
66
use phpmock\phpunit\PHPMock;
7+
use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
8+
use PHPUnit\Framework\Attributes\Group;
79
use PHPUnit\Framework\TestCase;
810

911
/**
1012
* @coversDefaultClass \Antistatique\Pricehubble\Pricehubble
1113
*
12-
* @group pricehubble
13-
* @group pricehubble_unit
14-
*
1514
* @internal
1615
*/
16+
#[Group('pricehubble')]
17+
#[Group('pricehubble_unit')]
1718
final class CurlAvailabilitiesTest extends TestCase
1819
{
1920
use PHPMock;
@@ -46,9 +47,8 @@ public function testcurlNotAvailable(): void
4647
/**
4748
* @covers ::__construct
4849
* @covers ::isCurlAvailable
49-
*
50-
* @doesNotPerformAssertions
5150
*/
51+
#[DoesNotPerformAssertions]
5252
public function testCurlAvailable(): void
5353
{
5454
$pricehubbleMock = $this->createMock(Pricehubble::class);

tests/Unit/PricehubbleAttachRequestPayloadTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
use Antistatique\Pricehubble\Pricehubble;
66
use Antistatique\Pricehubble\Tests\Traits\TestPrivateTrait;
77
use phpmock\phpunit\PHPMock;
8+
use PHPUnit\Framework\Attributes\Group;
89
use PHPUnit\Framework\TestCase;
910

1011
/**
1112
* @coversDefaultClass \Antistatique\Pricehubble\Pricehubble
1213
*
13-
* @group pricehubble
14-
* @group pricehubble_unit
15-
*
1614
* @internal
1715
*/
16+
#[Group('pricehubble')]
17+
#[Group('pricehubble_unit')]
1818
final class PricehubbleAttachRequestPayloadTest extends TestCase
1919
{
2020
use TestPrivateTrait;

tests/Unit/PricehubbleTest.php

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66
use Antistatique\Pricehubble\Resource\AbstractResource;
77
use Antistatique\Pricehubble\Tests\Traits\TestPrivateTrait;
88
use phpmock\phpunit\PHPMock;
9+
use PHPUnit\Framework\Attributes\DataProvider;
10+
use PHPUnit\Framework\Attributes\Group;
911
use PHPUnit\Framework\TestCase;
1012

1113
/**
1214
* @coversDefaultClass \Antistatique\Pricehubble\Pricehubble
1315
*
14-
* @group pricehubble
15-
* @group pricehubble_unit
16-
*
1716
* @internal
1817
*/
18+
#[Group('pricehubble')]
19+
#[Group('pricehubble_unit')]
1920
final class PricehubbleTest extends TestCase
2021
{
2122
use TestPrivateTrait;
@@ -125,7 +126,7 @@ public function testAuthenticateOnSuccessSetApiToken(): void
125126
$mock = $this->getMockBuilder(Pricehubble::class)
126127
->disableOriginalConstructor()
127128
->onlyMethods(['makeRequest', 'setApiToken'])
128-
->getMockForAbstractClass();
129+
->getMock();
129130

130131
$mock->expects(self::once())
131132
->method('makeRequest')
@@ -149,7 +150,7 @@ public function testAuthenticateOnError(): void
149150
$mock = $this->getMockBuilder(Pricehubble::class)
150151
->disableOriginalConstructor()
151152
->onlyMethods(['makeRequest', 'setApiToken'])
152-
->getMockForAbstractClass();
153+
->getMock();
153154

154155
$mock->expects(self::once())
155156
->method('makeRequest')
@@ -243,9 +244,8 @@ public function testGetHeadersAsArray()
243244

244245
/**
245246
* @covers ::findHttpStatus
246-
*
247-
* @dataProvider providerHttpStatus
248247
*/
248+
#[DataProvider('providerHttpStatus')]
249249
public function testFindHttpStatus($response, $formatted_response, $expected_code)
250250
{
251251
$code = $this->callPrivateMethod($this->pricehubble, 'findHttpStatus', [
@@ -261,7 +261,7 @@ public function testFindHttpStatus($response, $formatted_response, $expected_cod
261261
* @return array
262262
* Variation of HTTP Status response
263263
*/
264-
public function providerHttpStatus()
264+
public static function providerHttpStatus()
265265
{
266266
return [
267267
[
@@ -309,9 +309,8 @@ public function providerHttpStatus()
309309

310310
/**
311311
* @covers ::determineSuccess
312-
*
313-
* @dataProvider providerStatus200
314312
*/
313+
#[DataProvider('providerStatus200')]
315314
public function testDetermineSuccessStatus200($code)
316315
{
317316
$pricehubble_mock = $this->getMockBuilder(Pricehubble::class)
@@ -336,7 +335,7 @@ public function testDetermineSuccessStatus200($code)
336335
* @return array
337336
* Variation of HTTP Status response
338337
*/
339-
public function providerStatus200()
338+
public static function providerStatus200()
340339
{
341340
return [
342341
[
@@ -608,9 +607,8 @@ public function testMakeRequestGet(): void
608607

609608
/**
610609
* @covers ::makeRequest
611-
*
612-
* @dataProvider providerHttpVerbs
613610
*/
611+
#[DataProvider('providerHttpVerbs')]
614612
public function testMakeRequestByVerbs(string $verb): void
615613
{
616614
$pricehubble_mock = $this->getMockBuilder(Pricehubble::class)
@@ -693,7 +691,7 @@ public function testMakeRequestArgsLanguage(): void
693691
*
694692
* @return iterable Variation of HTTP Verbs
695693
*/
696-
public function providerHttpVerbs(): iterable
694+
public static function providerHttpVerbs(): iterable
697695
{
698696
yield ['post'];
699697
yield ['delete'];

tests/Unit/Resource/PointsOfInterestTest.php

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

55
use Antistatique\Pricehubble\Pricehubble;
66
use Antistatique\Pricehubble\Resource\AbstractResource;
7+
use PHPUnit\Framework\Attributes\Group;
78
use PHPUnit\Framework\TestCase;
89

910
/**
1011
* @coversDefaultClass \Antistatique\Pricehubble\Resource\PointsOfInterest
11-
*
12-
* @group pricehubble
13-
* @group pricehubble_unit
1412
*/
13+
#[Group('pricehubble')]
14+
#[Group('pricehubble_unit')]
1515
class PointsOfInterestTest extends TestCase
1616
{
1717
/**

tests/Unit/Resource/ValuationTest.php

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

55
use Antistatique\Pricehubble\Pricehubble;
66
use Antistatique\Pricehubble\Resource\AbstractResource;
7+
use PHPUnit\Framework\Attributes\Group;
78
use PHPUnit\Framework\TestCase;
89

910
/**
1011
* @coversDefaultClass \Antistatique\Pricehubble\Resource\Valuation
11-
*
12-
* @group pricehubble
13-
* @group pricehubble_unit
1412
*/
13+
#[Group('pricehubble')]
14+
#[Group('pricehubble_unit')]
1515
class ValuationTest extends TestCase
1616
{
1717
/**

0 commit comments

Comments
 (0)