File: 0002-Modernize-PHPUnit-syntax.patch

package info (click to toggle)
php-webmozart-assert 1.11.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 976 kB
  • sloc: php: 6,095; xml: 16; makefile: 13
file content (198 lines) | stat: -rw-r--r-- 5,618 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit@debian.org>
Date: Mon, 17 Feb 2025 15:59:34 +0100
Subject: Modernize PHPUnit syntax

---
 tests/AssertTest.php      | 35 +++++++++++------------------------
 tests/ProjectCodeTest.php | 18 ++++++++----------
 2 files changed, 19 insertions(+), 34 deletions(-)

diff --git a/tests/AssertTest.php b/tests/AssertTest.php
index 59c9b7b..eb88abb 100644
--- a/tests/AssertTest.php
+++ b/tests/AssertTest.php
@@ -16,6 +16,8 @@ use ArrayObject;
 use Error;
 use Exception;
 use LogicException;
+use PHPUnit\Framework\Attributes\AfterClass;
+use PHPUnit\Framework\Attributes\Group;
 use PHPUnit\Framework\TestCase;
 use RuntimeException;
 use stdClass;
@@ -42,6 +44,7 @@ class AssertTest extends TestCase
     /**
      * @afterClass
      */
+    #[AfterClass()]
     public static function doTearDownAfterClass()
     {
         //@fclose(self::$resource);
@@ -602,9 +605,7 @@ class AssertTest extends TestCase
         return array_values($methods);
     }
 
-    /**
-     * @group nophpunit11
-     */
+    #[Group('nophpunit11')]
     public function testAssert($method, $args, $success, $multibyte = false, $minVersion = null)
     {
         if ($minVersion && PHP_VERSION_ID < $minVersion) {
@@ -624,9 +625,7 @@ class AssertTest extends TestCase
         $this->addToAssertionCount(1);
     }
 
-    /**
-     * @group nophpunit11
-     */
+    #[Group('nophpunit11')]
     public function testNullOr($method, $args, $success, $multibyte = false, $minVersion = null)
     {
         if ($minVersion && PHP_VERSION_ID < $minVersion) {
@@ -646,18 +645,14 @@ class AssertTest extends TestCase
         $this->addToAssertionCount(1);
     }
 
-    /**
-     * @group nophpunit11
-     */
+    #[Group('nophpunit11')]
     public function testNullOrAcceptsNull($method)
     {
         call_user_func(array('Webmozart\Assert\Assert', 'nullOr'.ucfirst($method)), null, null, null);
         $this->addToAssertionCount(1);
     }
 
-    /**
-     * @group nophpunit11
-     */
+    #[Group('nophpunit11')]
     public function testAllArray($method, $args, $success, $multibyte = false, $minVersion = null)
     {
         if ($minVersion && PHP_VERSION_ID < $minVersion) {
@@ -680,9 +675,7 @@ class AssertTest extends TestCase
         $this->addToAssertionCount(1);
     }
 
-    /**
-     * @group nophpunit11
-     */
+    #[Group('nophpunit11')]
     public function testAllNullOrArray($method, $args, $success, $multibyte = false, $minVersion = null)
     {
         if ($minVersion && PHP_VERSION_ID < $minVersion) {
@@ -712,9 +705,7 @@ class AssertTest extends TestCase
         $this->addToAssertionCount(1);
     }
 
-    /**
-     * @group nophpunit11
-     */
+    #[Group('nophpunit11')]
     public function testAllTraversable($method, $args, $success, $multibyte = false, $minVersion = null)
     {
         if ($minVersion && PHP_VERSION_ID < $minVersion) {
@@ -762,9 +753,7 @@ class AssertTest extends TestCase
         );
     }
 
-    /**
-     * @group nophpunit11
-     */
+    #[Group('nophpunit11')]
     public function testConvertValuesToStrings($method, $args, $exceptionMessage)
     {
         $this->expectException('\InvalidArgumentException');
@@ -808,9 +797,7 @@ class AssertTest extends TestCase
         );
     }
 
-    /**
-     * @group nophpunit11
-     */
+    #[Group('nophpunit11')]
     public function testIsAOfExceptionMessages(array $args, string $exceptionMessage): void
     {
         $this->expectException('\InvalidArgumentException');
diff --git a/tests/ProjectCodeTest.php b/tests/ProjectCodeTest.php
index a0c2fe7..777a62c 100644
--- a/tests/ProjectCodeTest.php
+++ b/tests/ProjectCodeTest.php
@@ -2,6 +2,8 @@
 
 namespace Webmozart\Assert\Tests;
 
+use PHPUnit\Framework\Attributes\BeforeClass;
+use PHPUnit\Framework\Attributes\Group;
 use PHPUnit\Framework\TestCase;
 use ReflectionClass;
 use ReflectionMethod;
@@ -19,6 +21,7 @@ class ProjectCodeTest extends TestCase
     /**
      * @beforeClass
      */
+    #[BeforeClass()]
     public static function doSetUpBeforeClass()
     {
         self::$readmeContent = file_get_contents(__DIR__.'/../README.md');
@@ -33,10 +36,9 @@ class ProjectCodeTest extends TestCase
     }
 
     /**
-     * @group nophpunit11
-     *
      * @param string $method
      */
+    #[Group('nophpunit11')]
     public function testHasNullOr($method)
     {
         $fullMethodName = 'nullOr'.ucfirst($method);
@@ -62,10 +64,9 @@ class ProjectCodeTest extends TestCase
     }
 
     /**
-     * @group nophpunit11
-     *
      * @param string $method
      */
+    #[Group('nophpunit11')]
     public function testHasAll($method)
     {
         $fullMethodName = 'all'.ucfirst($method);
@@ -86,10 +87,9 @@ class ProjectCodeTest extends TestCase
     }
 
     /**
-     * @group nophpunit11
-     *
      * @param string $method
      */
+    #[Group('nophpunit11')]
     public function testIsInReadme($method)
     {
         $correct = strpos((string) self::$readmeContent, $method);
@@ -104,10 +104,9 @@ class ProjectCodeTest extends TestCase
     }
 
     /**
-     * @group nophpunit11
-     *
      * @param ReflectionMethod $method
      */
+    #[Group('nophpunit11')]
     public function testHasThrowsAnnotation($method)
     {
         $doc = $method->getDocComment();
@@ -131,10 +130,9 @@ class ProjectCodeTest extends TestCase
     }
 
     /**
-     * @group nophpunit11
-     *
      * @param ReflectionMethod $method
      */
+    #[Group('nophpunit11')]
     public function testHasCorrespondingStaticAnalysisFile($method)
     {
         $doc = $method->getDocComment();