Skip to content

Commit 5be821e

Browse files
s1lvermspirkov
andauthored
Raise min version phpunit to 12.5.0 (#547)
Co-authored-by: Maksim Spirkov <63721828+mspirkov@users.noreply.github.com>
1 parent 07343c7 commit 5be821e

29 files changed

Lines changed: 94 additions & 140 deletions

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"laravel/serializable-closure": "^v2.0.0"
2323
},
2424
"require-dev": {
25-
"phpunit/phpunit": "^10.5.0",
25+
"phpunit/phpunit": "^12.5.0",
2626
"yiisoft/yii2-redis": "~2.1.0",
2727
"yiisoft/yii2-debug": "~2.1.0",
2828
"yiisoft/yii2-gii": "~2.2.0",

phpcs.xml.dist

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,12 @@
66
<arg name="basepath" value="src"/>
77

88
<rule ref="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore">
9-
<exclude-pattern>/src/</exclude-pattern>
10-
<exclude-pattern>/tests/</exclude-pattern>
9+
<exclude-pattern>/*\.php$</exclude-pattern>
1110
</rule>
1211
<rule ref="PSR2.Files.ClosingTag.NotAllowed">
1312
<exclude-pattern>/gii/form\.php$</exclude-pattern>
1413
</rule>
1514
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen">
1615
<exclude-pattern>/gii/default/job\.php$</exclude-pattern>
1716
</rule>
18-
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
19-
<exclude-pattern>/tests/</exclude-pattern>
20-
</rule>
2117
</ruleset>

phpstan-baseline.neon

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,12 @@ parameters:
204204
count: 1
205205
path: src/drivers/amqp_interop/Queue.php
206206

207+
-
208+
message: '#^Callable callable\(\)\: mixed invoked with 1 parameter, 0 required\.$#'
209+
identifier: arguments.count
210+
count: 1
211+
path: src/drivers/amqp_interop/Queue.php
212+
207213
-
208214
message: '#^Cannot call method bind\(\) on Interop\\Queue\\Context\|null\.$#'
209215
identifier: method.nonObject
@@ -966,12 +972,6 @@ parameters:
966972
count: 1
967973
path: tests/drivers/beanstalk/QueueTest.php
968974

969-
-
970-
message: '#^PHPDoc tag @throws has invalid value \(\)\: Unexpected token "\\n ", expected type at offset 81 on line 4$#'
971-
identifier: phpDoc.parseError
972-
count: 1
973-
path: tests/drivers/beanstalk/QueueTest.php
974-
975975
-
976976
message: '#^Parameter \#1 \$filename of function file_get_contents expects string, bool\|string given\.$#'
977977
identifier: argument.type
@@ -1343,9 +1343,3 @@ parameters:
13431343
identifier: missingType.iterableValue
13441344
count: 1
13451345
path: tests/serializers/TestCase.php
1346-
1347-
-
1348-
message: '#^Property tests\\serializers\\TestObject\:\:\$bar type has no value type specified in iterable type array\.$#'
1349-
identifier: missingType.iterableValue
1350-
count: 1
1351-
path: tests/serializers/TestCase.php

phpunit.xml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
cacheDirectory=".phpunit.cache"
99
displayDetailsOnIncompleteTests="true"
1010
displayDetailsOnSkippedTests="true"
11+
displayDetailsOnTestsThatTriggerNotices="true"
1112
executionOrder="random"
13+
failOnNotice="true"
14+
failOnWarning="true"
15+
failOnSkipped="true"
1216
>
1317
<testsuites>
1418
<testsuite name="Yii2-Queue">

tests/JobEventTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*
2323
* @author Roman Zhuravlev <zhuravljov@gmail.com>
2424
*/
25-
class JobEventTest extends TestCase
25+
final class JobEventTest extends TestCase
2626
{
2727
public function testInvalidJob(): void
2828
{

tests/bootstrap.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<?php
22

3+
/**
4+
* @link https://www.yiiframework.com/
5+
* @copyright Copyright (c) 2008 Yii Software LLC
6+
* @license https://www.yiiframework.com/license/
7+
*/
8+
39
declare(strict_types=1);
410

511
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols

tests/cli/InfoActionTest.php

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@
2525
*
2626
* @author Kalmer Kaurson <kalmerkaurson@gmail.com>
2727
*/
28-
class InfoActionTest extends TestCase
28+
final class InfoActionTest extends TestCase
2929
{
3030
public function testWaitingCount(): void
3131
{
3232
$controller = $this->getMockBuilder(Controller::class)
3333
->setConstructorArgs(['testController', new Module('testModule')])
3434
->getMock();
3535

36-
$controller->expects(self::exactly(3))
36+
$controller
37+
->expects($this->exactly(3))
3738
->method('stdout')
3839
->willReturnOnConsecutiveCalls(
3940
[
@@ -54,11 +55,15 @@ public function testWaitingCount(): void
5455
$provider = $this->getMockBuilder(WaitingCountProvider::class)
5556
->setConstructorArgs([$queue])
5657
->getMock();
57-
$provider->expects(self::once())
58+
$provider
59+
->expects($this->once())
5860
->method('getWaitingCount')
5961
->willReturn(10);
6062

61-
$queue->method('getStatisticsProvider')->willReturn($provider);
63+
$queue
64+
->expects($this->once())
65+
->method('getStatisticsProvider')
66+
->willReturn($provider);
6267

6368
$action = (new InfoAction('infoAction', $controller, [
6469
'queue' => $queue,
@@ -72,7 +77,8 @@ public function testDelayedCount(): void
7277
->setConstructorArgs(['testController', new Module('testModule')])
7378
->getMock();
7479

75-
$controller->expects(self::exactly(3))
80+
$controller
81+
->expects($this->exactly(3))
7682
->method('stdout')
7783
->willReturnOnConsecutiveCalls(
7884
[
@@ -93,11 +99,15 @@ public function testDelayedCount(): void
9399
$provider = $this->getMockBuilder(DelayedCountProvider::class)
94100
->setConstructorArgs([$queue])
95101
->getMock();
96-
$provider->expects(self::once())
102+
$provider
103+
->expects($this->once())
97104
->method('getDelayedCount')
98105
->willReturn(10);
99106

100-
$queue->method('getStatisticsProvider')->willReturn($provider);
107+
$queue
108+
->expects($this->once())
109+
->method('getStatisticsProvider')
110+
->willReturn($provider);
101111

102112
$action = (new InfoAction('infoAction', $controller, [
103113
'queue' => $queue,
@@ -111,7 +121,8 @@ public function testReservedCount(): void
111121
->setConstructorArgs(['testController', new Module('testModule')])
112122
->getMock();
113123

114-
$controller->expects(self::exactly(3))
124+
$controller
125+
->expects($this->exactly(3))
115126
->method('stdout')
116127
->willReturnOnConsecutiveCalls(
117128
[
@@ -133,11 +144,15 @@ public function testReservedCount(): void
133144
->setConstructorArgs([$queue])
134145
->getMock()
135146
;
136-
$provider->expects(self::once())
147+
$provider
148+
->expects($this->once())
137149
->method('getReservedCount')
138150
->willReturn(10);
139151

140-
$queue->method('getStatisticsProvider')->willReturn($provider);
152+
$queue
153+
->expects($this->once())
154+
->method('getStatisticsProvider')
155+
->willReturn($provider);
141156

142157
$action = (new InfoAction('infoAction', $controller, [
143158
'queue' => $queue,
@@ -151,7 +166,8 @@ public function testDoneCount(): void
151166
->setConstructorArgs(['testController', new Module('testModule')])
152167
->getMock();
153168

154-
$controller->expects(self::exactly(3))
169+
$controller
170+
->expects($this->exactly(3))
155171
->method('stdout')
156172
->willReturnOnConsecutiveCalls(
157173
[
@@ -172,11 +188,15 @@ public function testDoneCount(): void
172188
$provider = $this->getMockBuilder(DoneCountProvider::class)
173189
->setConstructorArgs([$queue])
174190
->getMock();
175-
$provider->expects(self::once())
191+
$provider
192+
->expects($this->once())
176193
->method('getDoneCount')
177194
->willReturn(10);
178195

179-
$queue->method('getStatisticsProvider')->willReturn($provider);
196+
$queue
197+
->expects($this->once())
198+
->method('getStatisticsProvider')
199+
->willReturn($provider);
180200

181201
$action = (new InfoAction('infoAction', $controller, [
182202
'queue' => $queue,

tests/cli/Queue.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ protected function pushMessage(string $payload, $ttr, $delay, $priority): int|st
4040

4141
private StatisticsInterface $_statisticsProvider;
4242

43-
/**
44-
* @return StatisticsInterface
45-
*/
4643
public function getStatisticsProvider(): StatisticsInterface
4744
{
4845
if (!isset($this->_statisticsProvider)) {

tests/cli/providers/BaseStatisticsProvider.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
*/
2222
class BaseStatisticsProvider extends BaseObject implements StatisticsInterface
2323
{
24-
/**
25-
* @var Queue
26-
*/
2724
protected Queue $queue;
2825

2926
public function __construct(Queue $queue, array $config = [])

tests/closure/ClosureTest.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
* @author Roman Zhuravlev <zhuravljov@gmail.com>
2222
*/
23-
class ClosureTest extends TestCase
23+
final class ClosureTest extends TestCase
2424
{
2525
public function testPush1(): void
2626
{
@@ -68,9 +68,6 @@ public function testPush4(): void
6868
$this->assertFileExists($fileName);
6969
}
7070

71-
/**
72-
* @return Queue
73-
*/
7471
protected function getQueue(): Queue
7572
{
7673
if (!$this->_queue) {
@@ -84,9 +81,6 @@ protected function getQueue(): Queue
8481

8582
private $_queue;
8683

87-
/**
88-
* @inheritdoc
89-
*/
9084
protected function tearDown(): void
9185
{
9286
foreach (glob(Yii::getAlias('@runtime/job-*.lock')) as $fileName) {

0 commit comments

Comments
 (0)