File: 1010_phpunit-8.x%2B9.x.patch

package info (click to toggle)
php-horde-db 2.4.1-8.1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,480 kB
  • sloc: php: 9,205; xml: 1,007; sql: 22; sh: 16; makefile: 2
file content (305 lines) | stat: -rw-r--r-- 10,059 bytes parent folder | download | duplicates (2)
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
Description: Adapt to PHPUnit 8.x and 9.x API.
Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>

--- a/Horde_Db-2.4.1/test/Horde/Db/Adapter/MysqlBase.php
+++ b/Horde_Db-2.4.1/test/Horde/Db/Adapter/MysqlBase.php
@@ -31,7 +31,7 @@
         throw new LogicException('_available() must be implemented in a sub-class.');
     }
 
-    public static function setUpBeforeClass()
+    public static function setUpBeforeClass(): void
     {
         self::$_reason = 'The MySQL adapter is not available';
         if (static::_available()) {
@@ -131,9 +131,9 @@
 
     public function testQuoteFloat()
     {
-        $this->assertEquals('42.2', $this->_conn->quote(42.2));
+        $this->assertEquals('42.200000', $this->_conn->quote(42.2));
         setlocale(LC_NUMERIC, 'de_DE.UTF-8');
-        $this->assertEquals('42.2', $this->_conn->quote(42.2));
+        $this->assertEquals('42.200000', $this->_conn->quote(42.2));
     }
 
     public function testQuoteString()
@@ -257,9 +257,9 @@
     public function testColumns()
     {
         $col = parent::testColumns();
-        $this->assertEquals(10,        $col->getLimit());
+        $this->assertEquals(null,      $col->getLimit());
         $this->assertEquals(true,      $col->isUnsigned());
-        $this->assertEquals('int(10) unsigned', $col->getSqlType());
+        $this->assertEquals('int unsigned', $col->getSqlType());
     }
 
     public function testCreateTableWithSeparatePk()
--- a/Horde_Db-2.4.1/test/Horde/Db/Adapter/Oci8Test.php
+++ b/Horde_Db-2.4.1/test/Horde/Db/Adapter/Oci8Test.php
@@ -19,7 +19,7 @@
  */
 class Horde_Db_Adapter_Oci8Test extends Horde_Db_Adapter_TestBase
 {
-    public static function setUpBeforeClass()
+    public static function setUpBeforeClass(): void
     {
         self::$_reason = 'The OCI8 adapter is not available';
         if (extension_loaded('oci8')) {
@@ -114,9 +114,9 @@
 
     public function testQuoteFloat()
     {
-        $this->assertEquals('42.2', $this->_conn->quote(42.2));
+        $this->assertEquals('42.200000', $this->_conn->quote(42.2));
         setlocale(LC_NUMERIC, 'de_DE.UTF-8');
-        $this->assertEquals('42.2', $this->_conn->quote(42.2));
+        $this->assertEquals('42.200000', $this->_conn->quote(42.2));
     }
 
     public function testQuoteString()
--- a/Horde_Db-2.4.1/test/Horde/Db/Adapter/Pdo/PgsqlTest.php
+++ b/Horde_Db-2.4.1/test/Horde/Db/Adapter/Pdo/PgsqlTest.php
@@ -24,7 +24,7 @@
  */
 class Horde_Db_Adapter_Pdo_PgsqlTest extends Horde_Db_Adapter_TestBase
 {
-    public static function setUpBeforeClass()
+    public static function setUpBeforeClass(): void
     {
         self::$_reason = 'The pgsql adapter is not available';
         if (extension_loaded('pdo') &&
@@ -116,9 +116,9 @@
 
     public function testQuoteFloat()
     {
-        $this->assertEquals('42.2', $this->_conn->quote(42.2));
+        $this->assertEquals('42.200000', $this->_conn->quote(42.2));
         setlocale(LC_NUMERIC, 'de_DE.UTF-8');
-        $this->assertEquals('42.2', $this->_conn->quote(42.2));
+        $this->assertEquals('42.200000', $this->_conn->quote(42.2));
     }
 
     public function testQuoteString()
--- a/Horde_Db-2.4.1/test/Horde/Db/Adapter/Pdo/SqliteTest.php
+++ b/Horde_Db-2.4.1/test/Horde/Db/Adapter/Pdo/SqliteTest.php
@@ -24,7 +24,7 @@
  */
 class Horde_Db_Adapter_Pdo_SqliteTest extends Horde_Db_Adapter_TestBase
 {
-    public static function setUpBeforeClass()
+    public static function setUpBeforeClass(): void
     {
         self::$_reason = 'The sqlite adapter is not available';
         if (extension_loaded('pdo') &&
@@ -108,9 +108,9 @@
 
     public function testQuoteFloat()
     {
-        $this->assertEquals('42.2', $this->_conn->quote(42.2));
+        $this->assertEquals('42.200000', $this->_conn->quote(42.2));
         setlocale(LC_NUMERIC, 'de_DE.UTF-8');
-        $this->assertEquals('42.2', $this->_conn->quote(42.2));
+        $this->assertEquals('42.200000', $this->_conn->quote(42.2));
     }
 
     public function testQuoteString()
@@ -208,7 +208,7 @@
                                    array('precision' => '5', 'scale' => '2'));
 
         $afterChange = $this->_getColumn('sports', 'is_college');
-        $this->assertRegExp('/^decimal\(5,\s*2\)$/', $afterChange->getSqlType());
+        $this->assertMatchesRegularExpression('/^decimal\(5,\s*2\)$/', $afterChange->getSqlType());
     }
 
     public function testRenameColumn()
--- a/Horde_Db-2.4.1/test/Horde/Db/Adapter/TestBase.php
+++ b/Horde_Db-2.4.1/test/Horde/Db/Adapter/TestBase.php
@@ -41,7 +41,7 @@
         throw new LogicException('_getConnection() must be implemented in a sub-class.');
     }
 
-    protected function setUp()
+    protected function setUp(): void
     {
         if (self::$_skip ||
             !($res = static::_getConnection())) {
@@ -56,7 +56,7 @@
         $this->_dropTestTables();
     }
 
-    protected function tearDown()
+    protected function tearDown(): void
     {
         if ($this->_conn) {
             // clean up
@@ -120,7 +120,7 @@
         $this->assertGreaterThan(0, count(iterator_to_array($result)));
 
         foreach ($result as $row) break;
-        $this->assertInternalType('array', $row);
+        $this->assertIsArray($row);
         $this->assertEquals(1, $row['id']);
     }
 
@@ -134,7 +134,7 @@
         $this->assertGreaterThan(0, count(iterator_to_array($result)));
 
         foreach ($result as $row) break;
-        $this->assertInternalType('array', $row);
+        $this->assertIsArray($row);
         $this->assertEquals(1, $row['id']);
     }
 
@@ -148,7 +148,7 @@
         $this->assertGreaterThan(0, count(iterator_to_array($result)));
 
         foreach ($result as $row) break;
-        $this->assertInternalType('array', $row);
+        $this->assertIsArray($row);
         $this->assertEquals(1, $row['id']);
     }
 
@@ -158,7 +158,7 @@
 
         $sql = "SELECT * FROM unit_tests WHERE id='1'";
         $result = $this->_conn->selectAll($sql);
-        $this->assertInternalType('array', $result);
+        $this->assertIsArray($result);
         $this->assertGreaterThan(0, count($result));
         $this->assertEquals(1, $result[0]['id']);
     }
@@ -585,6 +585,8 @@
 
     public function testAddIndex()
     {
+        $this->expectNotToPerformAssertions();
+
         $this->_createTestUsersTable();
 
         // Limit size of last_name and key columns to support Firebird index
@@ -734,6 +736,8 @@
 
     public function testIndexNameInvalid()
     {
+        $this->expectNotToPerformAssertions();
+
         try {
             $name = $this->_conn->indexName('sports');
         } catch (Horde_Db_Exception $e) {
@@ -795,6 +799,8 @@
 
     public function testAddColumnNotNullWithoutDefault()
     {
+        $this->expectNotToPerformAssertions();
+
         $table = $this->_conn->createTable('testings');
         $table->column('foo', 'string');
         $table->end();
@@ -810,6 +816,8 @@
 
     public function testAddColumnNotNullWithDefault()
     {
+        $this->expectNotToPerformAssertions();
+
         $table = $this->_conn->createTable('testings');
             $table->column('foo', 'string');
         $table->end();
@@ -907,12 +915,10 @@
         $this->assertEquals(2, $this->_conn->selectValue('SELECT foo FROM autoinc WHERE bar = 6'));
     }
 
-    /**
-     * @expectedException LogicException
-     * @expectedExceptionMessage foo has already been added as a primary key
-     */
     public function testAutoIncrementWithTypeInTableAndColumnDefined()
     {
+        $this->expectException('LogicException');
+        $this->expectExceptionMessage('foo has already been added as a primary key');
         $table = $this->_conn->createTable('autoincrement', array('autoincrementKey' => 'foo'));
         $table->column('foo', 'integer');
         $table->column('bar', 'integer');
@@ -1154,31 +1160,43 @@
 
     public function testTableConstruct()
     {
+        $this->expectNotToPerformAssertions();
+
         self::$_tableTest->testConstruct();
     }
 
     public function testTableName()
     {
+        $this->expectNotToPerformAssertions();
+
         self::$_tableTest->testName();
     }
 
     public function testTableGetOptions()
     {
+        $this->expectNotToPerformAssertions();
+
         self::$_tableTest->testGetOptions();
     }
 
     public function testTablePrimaryKey()
     {
+        $this->expectNotToPerformAssertions();
+
         self::$_tableTest->testPrimaryKey();
     }
 
     public function testTableColumn()
     {
+        $this->expectNotToPerformAssertions();
+
         self::$_tableTest->testColumn();
     }
 
     public function testTableToSql()
     {
+        $this->expectNotToPerformAssertions();
+
         self::$_tableTest->testToSql();
     }
 }
--- a/Horde_Db-2.4.1/test/Horde/Db/Migration/BaseTest.php
+++ b/Horde_Db-2.4.1/test/Horde/Db/Migration/BaseTest.php
@@ -26,9 +26,9 @@
  * @package    Db
  * @subpackage UnitTests
  */
-class Horde_Db_Migration_BaseTest extends PHPUnit_Framework_TestCase
+class Horde_Db_Migration_BaseTest extends Horde_Test_Case
 {
-    public function setUp()
+    public function setUp(): void
     {
         try {
             $this->_conn = new Horde_Db_Adapter_Pdo_Sqlite(array(
--- a/Horde_Db-2.4.1/test/Horde/Db/Migration/MigratorTest.php
+++ b/Horde_Db-2.4.1/test/Horde/Db/Migration/MigratorTest.php
@@ -24,7 +24,7 @@
  */
 class Horde_Db_Migration_MigratorTest extends Horde_Test_Case
 {
-    public function setUp()
+    public function setUp(): void
     {
         try {
             $this->_conn = new Horde_Db_Adapter_Pdo_Sqlite(array(
@@ -178,6 +178,8 @@
 
     public function testWithDuplicates()
     {
+        $this->expectNotToPerformAssertions();
+
         try {
             $dir = dirname(__DIR__).'/fixtures/migrations_with_duplicate/';
             $migrator = new Horde_Db_Migration_Migrator($this->_conn, null, array('migrationsPath' => $dir));
--- /dev/null
+++ b/Horde_Db-2.4.1/test/Horde/Db/phpunit.xml
@@ -0,0 +1 @@
+<phpunit bootstrap="bootstrap.php"></phpunit>