File: 0008-Rename-AbstractTest-to-AbstractTestCase-for-phpunit-.patch

package info (click to toggle)
php-oscarotero-gettext 4.8.12-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,652 kB
  • sloc: php: 5,231; xml: 22; javascript: 18; makefile: 14
file content (341 lines) | stat: -rw-r--r-- 10,364 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
From: James Valleroy <jvalleroy@mailbox.org>
Date: Sat, 8 Jul 2023 13:05:36 -0400
Subject: Rename AbstractTest to AbstractTestCase for phpunit 10

---
 tests/AbstractTest.php          | 96 -----------------------------------------
 tests/AbstractTestCase.php      | 96 +++++++++++++++++++++++++++++++++++++++++
 tests/AssetsTest.php            |  2 +-
 tests/LocalesTest.php           |  2 +-
 tests/MergeEntriesTest.php      |  2 +-
 tests/MergeHeadersTest.php      |  2 +-
 tests/MergeTranslationsTest.php |  2 +-
 tests/StringsTest.php           |  2 +-
 tests/TranslationTest.php       |  2 +-
 tests/TranslationsTest.php      |  2 +-
 tests/TranslatorTest.php        |  2 +-
 11 files changed, 105 insertions(+), 105 deletions(-)
 delete mode 100644 tests/AbstractTest.php
 create mode 100644 tests/AbstractTestCase.php

diff --git a/tests/AbstractTest.php b/tests/AbstractTest.php
deleted file mode 100644
index 0134a83..0000000
--- a/tests/AbstractTest.php
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-
-namespace Gettext\Tests;
-
-use Gettext\Translations;
-use PHPUnit\Framework\TestCase;
-
-abstract class AbstractTest extends TestCase
-{
-    protected static $ext = [
-        'Blade' => 'php',
-        'Csv' => 'csv',
-        'CsvDictionary' => 'csv',
-        'Jed' => 'json',
-        'JsCode' => 'js',
-        'JsonDictionary' => 'json',
-        'Json' => 'json',
-        'Mo' => 'mo',
-        'PhpArray' => 'php',
-        'PhpCode' => 'php',
-        'Po' => 'po',
-        'Xliff' => 'xlf',
-        'Yaml' => 'yml',
-        'YamlDictionary' => 'yml',
-        'VueJs' => 'vue',
-    ];
-
-    protected static function asset($file)
-    {
-        return './tests/assets/'.$file;
-    }
-
-    /**
-     * @param string $file
-     * @param string|null $format
-     * @param array $options
-     * @return Translations
-     */
-    protected static function get($file, $format = null, array $options = [])
-    {
-        if ($format === null) {
-            $format = basename($file);
-        }
-
-        $method = "from{$format}File";
-        $file = static::asset($file.'.'.static::$ext[$format]);
-
-        return Translations::$method($file, $options);
-    }
-
-    protected function assertContent(Translations $translations, $file, $format = null)
-    {
-        if ($format === null) {
-            $format = basename($file);
-        }
-
-        $method = "to{$format}String";
-        $content = file_get_contents(static::asset($file.'.'.static::$ext[$format]));
-
-        // Po reference files are LittleEndian
-        if ($format !== 'Mo' || self::isLittleEndian()) {
-            $this->assertSame($content, $translations->$method(), $file);
-        }
-    }
-
-    protected static function saveContent(Translations $translations, $file, $format = null)
-    {
-        if ($format === null) {
-            $format = basename($file);
-        }
-
-        $method = "to{$format}String";
-        $file = static::asset($file.'.'.static::$ext[$format]);
-
-        file_put_contents($file, $translations->$method());
-    }
-
-    protected function runTestFormat($file, $countTranslations, $countTranslated = 0, $countHeaders = 8)
-    {
-        $format = basename($file);
-        $method = "from{$format}File";
-
-        /** @var Translations $translations */
-        $translations = Translations::$method(static::asset($file.'.'.static::$ext[$format]));
-
-        $this->assertCount($countTranslations, $translations);
-        $this->assertCount($countHeaders, $translations->getHeaders(), json_encode($translations->getHeaders(), JSON_PRETTY_PRINT));
-        $this->assertSame($countTranslated, $translations->countTranslated());
-        $this->assertContent($translations, $file);
-    }
-
-    protected function isLittleEndian()
-    {
-        return pack("s", 0x3031) === "10";
-    }
-}
diff --git a/tests/AbstractTestCase.php b/tests/AbstractTestCase.php
new file mode 100644
index 0000000..cf42ca3
--- /dev/null
+++ b/tests/AbstractTestCase.php
@@ -0,0 +1,96 @@
+<?php
+
+namespace Gettext\Tests;
+
+use Gettext\Translations;
+use PHPUnit\Framework\TestCase;
+
+abstract class AbstractTestCase extends TestCase
+{
+    protected static $ext = [
+        'Blade' => 'php',
+        'Csv' => 'csv',
+        'CsvDictionary' => 'csv',
+        'Jed' => 'json',
+        'JsCode' => 'js',
+        'JsonDictionary' => 'json',
+        'Json' => 'json',
+        'Mo' => 'mo',
+        'PhpArray' => 'php',
+        'PhpCode' => 'php',
+        'Po' => 'po',
+        'Xliff' => 'xlf',
+        'Yaml' => 'yml',
+        'YamlDictionary' => 'yml',
+        'VueJs' => 'vue',
+    ];
+
+    protected static function asset($file)
+    {
+        return './tests/assets/'.$file;
+    }
+
+    /**
+     * @param string $file
+     * @param string|null $format
+     * @param array $options
+     * @return Translations
+     */
+    protected static function get($file, $format = null, array $options = [])
+    {
+        if ($format === null) {
+            $format = basename($file);
+        }
+
+        $method = "from{$format}File";
+        $file = static::asset($file.'.'.static::$ext[$format]);
+
+        return Translations::$method($file, $options);
+    }
+
+    protected function assertContent(Translations $translations, $file, $format = null)
+    {
+        if ($format === null) {
+            $format = basename($file);
+        }
+
+        $method = "to{$format}String";
+        $content = file_get_contents(static::asset($file.'.'.static::$ext[$format]));
+
+        // Po reference files are LittleEndian
+        if ($format !== 'Mo' || self::isLittleEndian()) {
+            $this->assertSame($content, $translations->$method(), $file);
+        }
+    }
+
+    protected static function saveContent(Translations $translations, $file, $format = null)
+    {
+        if ($format === null) {
+            $format = basename($file);
+        }
+
+        $method = "to{$format}String";
+        $file = static::asset($file.'.'.static::$ext[$format]);
+
+        file_put_contents($file, $translations->$method());
+    }
+
+    protected function runTestFormat($file, $countTranslations, $countTranslated = 0, $countHeaders = 8)
+    {
+        $format = basename($file);
+        $method = "from{$format}File";
+
+        /** @var Translations $translations */
+        $translations = Translations::$method(static::asset($file.'.'.static::$ext[$format]));
+
+        $this->assertCount($countTranslations, $translations);
+        $this->assertCount($countHeaders, $translations->getHeaders(), json_encode($translations->getHeaders(), JSON_PRETTY_PRINT));
+        $this->assertSame($countTranslated, $translations->countTranslated());
+        $this->assertContent($translations, $file);
+    }
+
+    protected function isLittleEndian()
+    {
+        return pack("s", 0x3031) === "10";
+    }
+}
diff --git a/tests/AssetsTest.php b/tests/AssetsTest.php
index c836051..e36c079 100644
--- a/tests/AssetsTest.php
+++ b/tests/AssetsTest.php
@@ -6,7 +6,7 @@ use Gettext\Extractors\PhpCode;
 use Gettext\Extractors\VueJs;
 use Gettext\Translations;
 
-class AssetsTest extends AbstractTest
+class AssetsTest extends AbstractTestCase
 {
     public function testPo()
     {
diff --git a/tests/LocalesTest.php b/tests/LocalesTest.php
index 8b4191a..f2c23f2 100644
--- a/tests/LocalesTest.php
+++ b/tests/LocalesTest.php
@@ -4,7 +4,7 @@ namespace Gettext\Tests;
 
 use Gettext\Translations;
 
-class LocalesTest extends AbstractTest
+class LocalesTest extends AbstractTestCase
 {
     public function testPlurals()
     {
diff --git a/tests/MergeEntriesTest.php b/tests/MergeEntriesTest.php
index 5f5c381..081ad23 100644
--- a/tests/MergeEntriesTest.php
+++ b/tests/MergeEntriesTest.php
@@ -5,7 +5,7 @@ namespace Gettext\Tests;
 use Gettext\Translations;
 use Gettext\Merge;
 
-class MergeEntriesTest extends AbstractTest
+class MergeEntriesTest extends AbstractTestCase
 {
     protected $t1;
     protected $t2;
diff --git a/tests/MergeHeadersTest.php b/tests/MergeHeadersTest.php
index 1f02c95..6d3317e 100644
--- a/tests/MergeHeadersTest.php
+++ b/tests/MergeHeadersTest.php
@@ -5,7 +5,7 @@ namespace Gettext\Tests;
 use Gettext\Translations;
 use Gettext\Merge;
 
-class MergeHeadersTest extends AbstractTest
+class MergeHeadersTest extends AbstractTestCase
 {
     protected $t1;
     protected $t2;
diff --git a/tests/MergeTranslationsTest.php b/tests/MergeTranslationsTest.php
index 1726f61..210f327 100644
--- a/tests/MergeTranslationsTest.php
+++ b/tests/MergeTranslationsTest.php
@@ -5,7 +5,7 @@ namespace Gettext\Tests;
 use Gettext\Translation;
 use Gettext\Merge;
 
-class MergeTranslationsTest extends AbstractTest
+class MergeTranslationsTest extends AbstractTestCase
 {
     protected $t1;
     protected $t2;
diff --git a/tests/StringsTest.php b/tests/StringsTest.php
index 9fe0bd2..bc60b05 100644
--- a/tests/StringsTest.php
+++ b/tests/StringsTest.php
@@ -5,7 +5,7 @@ namespace Gettext\Tests;
 use Gettext\Extractors;
 use Gettext\Generators;
 
-class StringsTest extends AbstractTest
+class StringsTest extends AbstractTestCase
 {
     public function stringFromPhpProvider()
     {
diff --git a/tests/TranslationTest.php b/tests/TranslationTest.php
index 63e84d4..4f484d0 100644
--- a/tests/TranslationTest.php
+++ b/tests/TranslationTest.php
@@ -5,7 +5,7 @@ namespace Gettext\Tests;
 use Gettext\Translation;
 use Gettext\Translations;
 
-class TranslationTest extends AbstractTest
+class TranslationTest extends AbstractTestCase
 {
     public function testReferences()
     {
diff --git a/tests/TranslationsTest.php b/tests/TranslationsTest.php
index 8421c7e..cb6bd90 100644
--- a/tests/TranslationsTest.php
+++ b/tests/TranslationsTest.php
@@ -5,7 +5,7 @@ namespace Gettext\Tests;
 use Gettext\Translation;
 use Gettext\Translations;
 
-class TranslationsTest extends AbstractTest
+class TranslationsTest extends AbstractTestCase
 {
     public function testClone()
     {
diff --git a/tests/TranslatorTest.php b/tests/TranslatorTest.php
index 6867ec0..68a7d49 100755
--- a/tests/TranslatorTest.php
+++ b/tests/TranslatorTest.php
@@ -7,7 +7,7 @@ use Gettext\Translations;
 use Gettext\Translation;
 use Gettext\Translator;
 
-class TranslatorTest extends AbstractTest
+class TranslatorTest extends AbstractTestCase
 {
     public function testNoop()
     {