File: 0002-Modernize-PHPUnit-syntax.patch

package info (click to toggle)
php-algo26-idna-convert 3.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 592 kB
  • sloc: php: 5,691; xml: 18; makefile: 18
file content (166 lines) | stat: -rw-r--r-- 5,324 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
From: =?utf-8?q?David_Pr=C3=A9vot?= <david@tilapin.org>
Date: Wed, 26 Feb 2025 08:53:48 +0100
Subject: Modernize PHPUnit syntax

---
 tests/integration/ToIdnTest.php     | 13 +++++--------
 tests/integration/ToUnicodeTest.php | 13 +++++--------
 tests/unit/namePrepTest.php         |  7 +++----
 3 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/tests/integration/ToIdnTest.php b/tests/integration/ToIdnTest.php
index 7ee5392..3984f5f 100644
--- a/tests/integration/ToIdnTest.php
+++ b/tests/integration/ToIdnTest.php
@@ -5,6 +5,7 @@ use Algo26\IdnaConvert\Exception\AlreadyPunycodeException;
 use Algo26\IdnaConvert\Exception\InvalidCharacterException;
 use Algo26\IdnaConvert\Exception\InvalidIdnVersionException;
 use Algo26\IdnaConvert\ToIdn;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 
 /**
@@ -13,12 +14,11 @@ use PHPUnit\Framework\TestCase;
 class ToIdnTest extends TestCase
 {
     /**
-     * @dataProvider providerUtf8
-     *
      * @throws AlreadyPunycodeException
      * @throws InvalidCharacterException
      * @throws InvalidIdnVersionException
      */
+    #[DataProvider('providerUtf8')]
     public function testEncodeUtf8($decoded, $expectEncoded)
     {
         $idnaConvert = new ToIdn();
@@ -36,12 +36,11 @@ class ToIdnTest extends TestCase
     }
 
     /**
-     * @dataProvider providerUtf8Idna2003
-     *
      * @throws AlreadyPunycodeException
      * @throws InvalidCharacterException
      * @throws InvalidIdnVersionException
      */
+    #[DataProvider('providerUtf8Idna2003')]
     public function testEncodeUtf8Idna2003($decoded, $expectEncoded)
     {
         $idnaConvert = new ToIdn(2003);
@@ -59,10 +58,9 @@ class ToIdnTest extends TestCase
     }
 
     /**
-     * @dataProvider providerEmailAddress
-     *
      * @throws InvalidIdnVersionException
      */
+    #[DataProvider('providerEmailAddress')]
     public function testEncodeEmailAddress($decoded, $expectEncoded)
     {
         $idnaConvert = new ToIdn(2008);
@@ -80,10 +78,9 @@ class ToIdnTest extends TestCase
     }
 
     /**
-     * @dataProvider providerUrl
-     *
      * @throws InvalidIdnVersionException
      */
+    #[DataProvider('providerUrl')]
     public function testEncodeUrl($decoded, $expectEncoded)
     {
         $idnaConvert = new ToIdn(2008);
diff --git a/tests/integration/ToUnicodeTest.php b/tests/integration/ToUnicodeTest.php
index c11e828..09d7623 100644
--- a/tests/integration/ToUnicodeTest.php
+++ b/tests/integration/ToUnicodeTest.php
@@ -4,6 +4,7 @@ namespace Algo26\IdnaConvert\Test;
 use Algo26\IdnaConvert\Exception\InvalidCharacterException;
 use Algo26\IdnaConvert\Exception\InvalidIdnVersionException;
 use Algo26\IdnaConvert\ToUnicode;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 
 /**
@@ -12,9 +13,9 @@ use PHPUnit\Framework\TestCase;
 class ToUnicodeTest extends TestCase
 {
     /**
-     * @dataProvider providerUtf8
      * @throws InvalidIdnVersionException
      */
+    #[DataProvider('providerUtf8')]
     public function testDecodeUtf8($encoded, $expectDecoded)
     {
         $idnaConvert = new ToUnicode();
@@ -31,9 +32,7 @@ class ToUnicodeTest extends TestCase
         );
     }
 
-    /**
-     * @dataProvider providerException
-     */
+    #[DataProvider('providerException')]
     public function testDecodeUtf8Exception($encoded)
     {
         self::expectException(InvalidCharacterException::class);
@@ -43,10 +42,9 @@ class ToUnicodeTest extends TestCase
     }
 
     /**
-     * @dataProvider providerEmailAddress
-     *
      * @throws InvalidIdnVersionException
      */
+    #[DataProvider('providerEmailAddress')]
     public function testDecodeEmailAddress($encoded, $expectDecoded)
     {
         $idnaConvert = new ToUnicode();
@@ -64,10 +62,9 @@ class ToUnicodeTest extends TestCase
     }
 
     /**
-     * @dataProvider providerUrl
-     *
      * @throws InvalidIdnVersionException
      */
+    #[DataProvider('providerUrl')]
     public function testDecodeUrl($encoded, $expectDecoded)
     {
         $idnaConvert = new ToUnicode();
diff --git a/tests/unit/namePrepTest.php b/tests/unit/namePrepTest.php
index 700a7b6..1905445 100644
--- a/tests/unit/namePrepTest.php
+++ b/tests/unit/namePrepTest.php
@@ -6,6 +6,7 @@ use Algo26\IdnaConvert\Exception\InvalidCharacterException;
 use Algo26\IdnaConvert\Exception\InvalidIdnVersionException;
 use Algo26\IdnaConvert\NamePrep\NamePrep;
 use Algo26\IdnaConvert\TranscodeUnicode\TranscodeUnicode;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 
 /**
@@ -34,9 +35,8 @@ class namePrepTest extends TestCase
     /**
      * @param array|string $from provided original string
      * @param array|string $expectedTo expected result
-     *
-     * @dataProvider providerMapping2003
      */
+    #[DataProvider('providerMapping2003')]
     public function testSuccess2003($from, $expectedTo)
     {
         if (!is_array($from)) {
@@ -61,9 +61,8 @@ class namePrepTest extends TestCase
 
     /**
      * @param array|string $sequence as UTF-8 string or UCS-4 array
-     *
-     * @dataProvider providerProhibited
      */
+    #[DataProvider('providerProhibited')]
     public function testProhibited($sequence)
     {
         if (!is_array($sequence)) {