File: switch-to-using-createMock.patch

package info (click to toggle)
libphp-swiftmailer 6.3.0-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,164 kB
  • sloc: php: 27,203; sh: 36; makefile: 16
file content (650 lines) | stat: -rw-r--r-- 31,802 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
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
From: Joe Nahmias <jello@debian.org>
Date: Thu, 11 Sep 2025 22:46:38 -0400
Subject: switch to using createMock()

---
 .../ByteStream/FileByteStreamAcceptanceTest.php    |  2 +-
 .../AbstractStreamBufferAcceptanceTest.php         |  4 +-
 .../Transport/StreamBuffer/SocketTimeoutTest.php   |  2 +-
 .../unit/Swift/ByteStream/ArrayByteStreamTest.php  | 12 +++---
 tests/unit/Swift/Events/CommandEventTest.php       |  2 +-
 tests/unit/Swift/Events/ResponseEventTest.php      |  2 +-
 tests/unit/Swift/Events/SendEventTest.php          |  4 +-
 .../Swift/Events/SimpleEventDispatcherTest.php     | 44 +++++++++++-----------
 .../unit/Swift/Events/TransportChangeEventTest.php |  2 +-
 .../Swift/Events/TransportExceptionEventTest.php   |  2 +-
 tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php    |  6 +--
 .../KeyCache/SimpleKeyCacheInputStreamTest.php     |  6 +--
 tests/unit/Swift/Mime/AbstractMimeEntityTest.php   |  4 +-
 tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php  |  4 +-
 tests/unit/Swift/Mime/SimpleHeaderSetTest.php      |  4 +-
 tests/unit/Swift/Plugins/AntiFloodPluginTest.php   |  8 ++--
 .../Swift/Plugins/BandwidthMonitorPluginTest.php   | 14 ++-----
 tests/unit/Swift/Plugins/LoggerPluginTest.php      | 20 +++-------
 .../unit/Swift/Plugins/PopBeforeSmtpPluginTest.php |  8 ++--
 tests/unit/Swift/Plugins/RedirectingPluginTest.php |  4 +-
 .../Swift/Plugins/Reporters/HitReporterTest.php    |  2 +-
 .../Swift/Plugins/Reporters/HtmlReporterTest.php   |  2 +-
 tests/unit/Swift/Transport/StreamBufferTest.php    |  4 +-
 23 files changed, 71 insertions(+), 91 deletions(-)

diff --git a/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php b/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php
index 5480e55..cb07c91 100644
--- a/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php
+++ b/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php
@@ -164,7 +164,7 @@ class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit\Framework\T
 
     private function createMockInputStream()
     {
-        return $this->getMockBuilder('Swift_InputByteStream')->getMock();
+        return $this->createMock('Swift_InputByteStream');
     }
 
     private function createFileStream($file, $writable = false)
diff --git a/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php b/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php
index 5feb9d3..6b91b9b 100644
--- a/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php
+++ b/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php
@@ -16,7 +16,7 @@ abstract class Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest e
         }
 
         $this->buffer = new Swift_Transport_StreamBuffer(
-            $this->getMockBuilder('Swift_ReplacementFilterFactory')->getMock()
+            $this->createMock('Swift_ReplacementFilterFactory')
         );
     }
 
@@ -138,6 +138,6 @@ abstract class Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest e
 
     private function createMockInputStream()
     {
-        return $this->getMockBuilder('Swift_InputByteStream')->getMock();
+        return $this->createMock('Swift_InputByteStream');
     }
 }
diff --git a/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php b/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php
index 1f96700..559fa4c 100644
--- a/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php
+++ b/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php
@@ -25,7 +25,7 @@ class Swift_Transport_StreamBuffer_SocketTimeoutTest extends \PHPUnit\Framework\
         }
 
         $this->buffer = new Swift_Transport_StreamBuffer(
-            $this->getMockBuilder('Swift_ReplacementFilterFactory')->getMock()
+            $this->createMock('Swift_ReplacementFilterFactory')
         );
     }
 
diff --git a/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php b/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php
index 0dd8e7f..b87b5b0 100644
--- a/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php
+++ b/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php
@@ -129,8 +129,8 @@ class Swift_ByteStream_ArrayByteStreamTest extends \PHPUnit\Framework\TestCase
     public function testBindingOtherStreamsMirrorsWriteOperations()
     {
         $bs = $this->createArrayStream('');
-        $is1 = $this->getMockBuilder('Swift_InputByteStream')->getMock();
-        $is2 = $this->getMockBuilder('Swift_InputByteStream')->getMock();
+        $is1 = $this->createMock('Swift_InputByteStream');
+        $is2 = $this->createMock('Swift_InputByteStream');
         $matcher = $this->exactly(2);
 
         $is1->expects($matcher)
@@ -163,8 +163,8 @@ class Swift_ByteStream_ArrayByteStreamTest extends \PHPUnit\Framework\TestCase
     public function testBindingOtherStreamsMirrorsFlushOperations()
     {
         $bs = $this->createArrayStream('');
-        $is1 = $this->getMockBuilder('Swift_InputByteStream')->getMock();
-        $is2 = $this->getMockBuilder('Swift_InputByteStream')->getMock();
+        $is1 = $this->createMock('Swift_InputByteStream');
+        $is2 = $this->createMock('Swift_InputByteStream');
 
         $is1->expects($this->once())
             ->method('flushBuffers');
@@ -180,8 +180,8 @@ class Swift_ByteStream_ArrayByteStreamTest extends \PHPUnit\Framework\TestCase
     public function testUnbindingStreamPreventsFurtherWrites()
     {
         $bs = $this->createArrayStream('');
-        $is1 = $this->getMockBuilder('Swift_InputByteStream')->getMock();
-        $is2 = $this->getMockBuilder('Swift_InputByteStream')->getMock();
+        $is1 = $this->createMock('Swift_InputByteStream');
+        $is2 = $this->createMock('Swift_InputByteStream');
         $matcher = $this->exactly(2);
 
         $is1->expects($matcher)
diff --git a/tests/unit/Swift/Events/CommandEventTest.php b/tests/unit/Swift/Events/CommandEventTest.php
index 2915870..e1ef75e 100644
--- a/tests/unit/Swift/Events/CommandEventTest.php
+++ b/tests/unit/Swift/Events/CommandEventTest.php
@@ -29,6 +29,6 @@ class Swift_Events_CommandEventTest extends \PHPUnit\Framework\TestCase
 
     private function createTransport()
     {
-        return $this->getMockBuilder('Swift_Transport')->getMock();
+        return $this->createMock('Swift_Transport');
     }
 }
diff --git a/tests/unit/Swift/Events/ResponseEventTest.php b/tests/unit/Swift/Events/ResponseEventTest.php
index ba5c191..90e61b3 100644
--- a/tests/unit/Swift/Events/ResponseEventTest.php
+++ b/tests/unit/Swift/Events/ResponseEventTest.php
@@ -33,6 +33,6 @@ class Swift_Events_ResponseEventTest extends \PHPUnit\Framework\TestCase
 
     private function createTransport()
     {
-        return $this->getMockBuilder('Swift_Transport')->getMock();
+        return $this->createMock('Swift_Transport');
     }
 }
diff --git a/tests/unit/Swift/Events/SendEventTest.php b/tests/unit/Swift/Events/SendEventTest.php
index 9f55589..898fe06 100644
--- a/tests/unit/Swift/Events/SendEventTest.php
+++ b/tests/unit/Swift/Events/SendEventTest.php
@@ -86,11 +86,11 @@ class Swift_Events_SendEventTest extends \PHPUnit\Framework\TestCase
 
     private function createTransport()
     {
-        return $this->getMockBuilder('Swift_Transport')->getMock();
+        return $this->createMock('Swift_Transport');
     }
 
     private function createMessage()
     {
-        return $this->getMockBuilder('Swift_Mime_SimpleMessage')->disableOriginalConstructor()->getMock();
+        return $this->createMock('Swift_Mime_SimpleMessage');
     }
 }
diff --git a/tests/unit/Swift/Events/SimpleEventDispatcherTest.php b/tests/unit/Swift/Events/SimpleEventDispatcherTest.php
index 5888aeb..4272bb3 100644
--- a/tests/unit/Swift/Events/SimpleEventDispatcherTest.php
+++ b/tests/unit/Swift/Events/SimpleEventDispatcherTest.php
@@ -11,8 +11,8 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit\Framework\TestCase
 
     public function testSendEventCanBeCreated()
     {
-        $transport = $this->getMockBuilder('Swift_Transport')->getMock();
-        $message = $this->getMockBuilder('Swift_Mime_SimpleMessage')->disableOriginalConstructor()->getMock();
+        $transport = $this->createMock('Swift_Transport');
+        $message = $this->createMock('Swift_Mime_SimpleMessage');
         $evt = $this->dispatcher->createSendEvent($transport, $message);
         $this->assertInstanceOf('Swift_Events_SendEvent', $evt);
         $this->assertSame($message, $evt->getMessage());
@@ -21,7 +21,7 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit\Framework\TestCase
 
     public function testCommandEventCanBeCreated()
     {
-        $buf = $this->getMockBuilder('Swift_Transport')->getMock();
+        $buf = $this->createMock('Swift_Transport');
         $evt = $this->dispatcher->createCommandEvent($buf, "FOO\r\n", [250]);
         $this->assertInstanceOf('Swift_Events_CommandEvent', $evt);
         $this->assertSame($buf, $evt->getSource());
@@ -31,7 +31,7 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit\Framework\TestCase
 
     public function testResponseEventCanBeCreated()
     {
-        $buf = $this->getMockBuilder('Swift_Transport')->getMock();
+        $buf = $this->createMock('Swift_Transport');
         $evt = $this->dispatcher->createResponseEvent($buf, "250 Ok\r\n", true);
         $this->assertInstanceOf('Swift_Events_ResponseEvent', $evt);
         $this->assertSame($buf, $evt->getSource());
@@ -41,7 +41,7 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit\Framework\TestCase
 
     public function testTransportChangeEventCanBeCreated()
     {
-        $transport = $this->getMockBuilder('Swift_Transport')->getMock();
+        $transport = $this->createMock('Swift_Transport');
         $evt = $this->dispatcher->createTransportChangeEvent($transport);
         $this->assertInstanceOf('Swift_Events_TransportChangeEvent', $evt);
         $this->assertSame($transport, $evt->getSource());
@@ -49,7 +49,7 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit\Framework\TestCase
 
     public function testTransportExceptionEventCanBeCreated()
     {
-        $transport = $this->getMockBuilder('Swift_Transport')->getMock();
+        $transport = $this->createMock('Swift_Transport');
         $ex = new Swift_TransportException('');
         $evt = $this->dispatcher->createTransportExceptionEvent($transport, $ex);
         $this->assertInstanceOf('Swift_Events_TransportExceptionEvent', $evt);
@@ -59,12 +59,12 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit\Framework\TestCase
 
     public function testListenersAreNotifiedOfDispatchedEvent()
     {
-        $transport = $this->getMockBuilder('Swift_Transport')->getMock();
+        $transport = $this->createMock('Swift_Transport');
 
         $evt = $this->dispatcher->createTransportChangeEvent($transport);
 
-        $listenerA = $this->getMockBuilder('Swift_Events_TransportChangeListener')->getMock();
-        $listenerB = $this->getMockBuilder('Swift_Events_TransportChangeListener')->getMock();
+        $listenerA = $this->createMock('Swift_Events_TransportChangeListener');
+        $listenerB = $this->createMock('Swift_Events_TransportChangeListener');
 
         $this->dispatcher->bindEventListener($listenerA);
         $this->dispatcher->bindEventListener($listenerB);
@@ -81,13 +81,13 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit\Framework\TestCase
 
     public function testListenersAreOnlyCalledIfImplementingCorrectInterface()
     {
-        $transport = $this->getMockBuilder('Swift_Transport')->getMock();
-        $message = $this->getMockBuilder('Swift_Mime_SimpleMessage')->disableOriginalConstructor()->getMock();
+        $transport = $this->createMock('Swift_Transport');
+        $message = $this->createMock('Swift_Mime_SimpleMessage');
 
         $evt = $this->dispatcher->createSendEvent($transport, $message);
 
-        $targetListener = $this->getMockBuilder('Swift_Events_SendListener')->getMock();
-        $otherListener = $this->getMockBuilder('DummyListener')->getMock();
+        $targetListener = $this->createMock('Swift_Events_SendListener');
+        $otherListener = $this->createMock('DummyListener');
 
         $this->dispatcher->bindEventListener($targetListener);
         $this->dispatcher->bindEventListener($otherListener);
@@ -103,13 +103,13 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit\Framework\TestCase
 
     public function testListenersCanCancelBubblingOfEvent()
     {
-        $transport = $this->getMockBuilder('Swift_Transport')->getMock();
-        $message = $this->getMockBuilder('Swift_Mime_SimpleMessage')->disableOriginalConstructor()->getMock();
+        $transport = $this->createMock('Swift_Transport');
+        $message = $this->createMock('Swift_Mime_SimpleMessage');
 
         $evt = $this->dispatcher->createSendEvent($transport, $message);
 
-        $listenerA = $this->getMockBuilder('Swift_Events_SendListener')->getMock();
-        $listenerB = $this->getMockBuilder('Swift_Events_SendListener')->getMock();
+        $listenerA = $this->createMock('Swift_Events_SendListener');
+        $listenerB = $this->createMock('Swift_Events_SendListener');
 
         $this->dispatcher->bindEventListener($listenerA);
         $this->dispatcher->bindEventListener($listenerB);
@@ -130,19 +130,19 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit\Framework\TestCase
 
     public function testPreventFlushingQueueBubbleOnInternalEventsRising()
     {
-        $transport = $this->getMockBuilder('Swift_Transport')->getMock();
-        $message = $this->getMockBuilder('Swift_Mime_SimpleMessage')->disableOriginalConstructor()->getMock();
+        $transport = $this->createMock('Swift_Transport');
+        $message = $this->createMock('Swift_Mime_SimpleMessage');
 
         $evtA = $this->dispatcher->createSendEvent($transport, $message);
 
         $evtB = $this->dispatcher->createTransportChangeEvent($transport);
 
-        $listenerB = $this->getMockBuilder('Swift_Events_TransportChangeListener')->getMock();
+        $listenerB = $this->createMock('Swift_Events_TransportChangeListener');
 
         $this->dispatcher->bindEventListener($listenerB);
 
-        $listenerA1 = $this->getMockBuilder('Swift_Events_SendListener')->getMock();
-        $listenerA2 = $this->getMockBuilder('Swift_Events_SendListener')->getMock();
+        $listenerA1 = $this->createMock('Swift_Events_SendListener');
+        $listenerA2 = $this->createMock('Swift_Events_SendListener');
 
         $this->dispatcher->bindEventListener($listenerA1);
         $this->dispatcher->bindEventListener($listenerA2);
diff --git a/tests/unit/Swift/Events/TransportChangeEventTest.php b/tests/unit/Swift/Events/TransportChangeEventTest.php
index 625b96c..3dc6e8a 100644
--- a/tests/unit/Swift/Events/TransportChangeEventTest.php
+++ b/tests/unit/Swift/Events/TransportChangeEventTest.php
@@ -25,6 +25,6 @@ class Swift_Events_TransportChangeEventTest extends \PHPUnit\Framework\TestCase
 
     private function createTransport()
     {
-        return $this->getMockBuilder('Swift_Transport')->getMock();
+        return $this->createMock('Swift_Transport');
     }
 }
diff --git a/tests/unit/Swift/Events/TransportExceptionEventTest.php b/tests/unit/Swift/Events/TransportExceptionEventTest.php
index 033b0e5..6dd3d2d 100644
--- a/tests/unit/Swift/Events/TransportExceptionEventTest.php
+++ b/tests/unit/Swift/Events/TransportExceptionEventTest.php
@@ -31,7 +31,7 @@ class Swift_Events_TransportExceptionEventTest extends \PHPUnit\Framework\TestCa
 
     private function createTransport()
     {
-        return $this->getMockBuilder('Swift_Transport')->getMock();
+        return $this->createMock('Swift_Transport');
     }
 
     private function createException()
diff --git a/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php b/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php
index 9edb95b..bec6a60 100644
--- a/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php
+++ b/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php
@@ -201,16 +201,16 @@ class Swift_KeyCache_ArrayKeyCacheTest extends \PHPUnit\Framework\TestCase
 
     private function createKeyCacheInputStream()
     {
-        return $this->getMockBuilder('Swift_KeyCache_KeyCacheInputStream')->getMock();
+        return $this->createMock('Swift_KeyCache_KeyCacheInputStream');
     }
 
     private function createOutputStream()
     {
-        return $this->getMockBuilder('Swift_OutputByteStream')->getMock();
+        return $this->createMock('Swift_OutputByteStream');
     }
 
     private function createInputStream()
     {
-        return $this->getMockBuilder('Swift_InputByteStream')->getMock();
+        return $this->createMock('Swift_InputByteStream');
     }
 }
diff --git a/tests/unit/Swift/KeyCache/SimpleKeyCacheInputStreamTest.php b/tests/unit/Swift/KeyCache/SimpleKeyCacheInputStreamTest.php
index e36eafc..ad2ae2f 100644
--- a/tests/unit/Swift/KeyCache/SimpleKeyCacheInputStreamTest.php
+++ b/tests/unit/Swift/KeyCache/SimpleKeyCacheInputStreamTest.php
@@ -6,7 +6,7 @@ class Swift_KeyCache_SimpleKeyCacheInputStreamTest extends \PHPUnit\Framework\Te
 
     public function testStreamWritesToCacheInAppendMode()
     {
-        $cache = $this->getMockBuilder('Swift_KeyCache')->getMock();
+        $cache = $this->createMock('Swift_KeyCache');
         $matcher = $this->exactly(3);
         $cache->expects($matcher)
               ->method('setString')->willReturnCallback(function (...$parameters) use ($matcher) {
@@ -42,7 +42,7 @@ class Swift_KeyCache_SimpleKeyCacheInputStreamTest extends \PHPUnit\Framework\Te
 
     public function testFlushContentClearsKey()
     {
-        $cache = $this->getMockBuilder('Swift_KeyCache')->getMock();
+        $cache = $this->createMock('Swift_KeyCache');
         $cache->expects($this->once())
               ->method('clearKey')
               ->with($this->nsKey, 'foo');
@@ -57,7 +57,7 @@ class Swift_KeyCache_SimpleKeyCacheInputStreamTest extends \PHPUnit\Framework\Te
 
     public function testClonedStreamStillReferencesSameCache()
     {
-        $cache = $this->getMockBuilder('Swift_KeyCache')->getMock();
+        $cache = $this->createMock('Swift_KeyCache');
         $matcher = $this->exactly(3);
         $cache->expects($matcher)
               ->method('setString')->willReturnCallback(function (...$parameters) use ($matcher) {
diff --git a/tests/unit/Swift/Mime/AbstractMimeEntityTest.php b/tests/unit/Swift/Mime/AbstractMimeEntityTest.php
index ad80553..d9a86fa 100644
--- a/tests/unit/Swift/Mime/AbstractMimeEntityTest.php
+++ b/tests/unit/Swift/Mime/AbstractMimeEntityTest.php
@@ -1007,7 +1007,7 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
 
     protected function createEncoder($name = 'quoted-printable', $stub = true)
     {
-        $encoder = $this->getMockBuilder('Swift_Mime_ContentEncoder')->getMock();
+        $encoder = $this->createMock('Swift_Mime_ContentEncoder');
         $encoder->expects($this->any())
                 ->method('getName')
                 ->willReturn($name);
@@ -1087,6 +1087,6 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
 
     protected function createInputStream($stub = true)
     {
-        return $this->getMockBuilder('Swift_InputByteStream')->getMock();
+        return $this->createMock('Swift_InputByteStream');
     }
 }
diff --git a/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php b/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php
index fd56415..bda2635 100644
--- a/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php
+++ b/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php
@@ -159,11 +159,11 @@ class Swift_Mime_SimpleHeaderFactoryTest extends \PHPUnit\Framework\TestCase
 
     private function createHeaderEncoder()
     {
-        return $this->getMockBuilder('Swift_Mime_HeaderEncoder')->getMock();
+        return $this->createMock('Swift_Mime_HeaderEncoder');
     }
 
     private function createParamEncoder()
     {
-        return $this->getMockBuilder('Swift_Encoder')->getMock();
+        return $this->createMock('Swift_Encoder');
     }
 }
diff --git a/tests/unit/Swift/Mime/SimpleHeaderSetTest.php b/tests/unit/Swift/Mime/SimpleHeaderSetTest.php
index c62a06e..6377458 100644
--- a/tests/unit/Swift/Mime/SimpleHeaderSetTest.php
+++ b/tests/unit/Swift/Mime/SimpleHeaderSetTest.php
@@ -804,12 +804,12 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit\Framework\TestCase
 
     private function createFactory()
     {
-        return $this->getMockBuilder('Swift_Mime_SimpleHeaderFactory')->disableOriginalConstructor()->getMock();
+        return $this->createMock('Swift_Mime_SimpleHeaderFactory');
     }
 
     private function createHeader($name, $body = '')
     {
-        $header = $this->getMockBuilder('Swift_Mime_Header')->getMock();
+        $header = $this->createMock('Swift_Mime_Header');
         $header->expects($this->any())
                ->method('getFieldName')
                ->willReturn($name);
diff --git a/tests/unit/Swift/Plugins/AntiFloodPluginTest.php b/tests/unit/Swift/Plugins/AntiFloodPluginTest.php
index 2c1e33a..0bf4d83 100644
--- a/tests/unit/Swift/Plugins/AntiFloodPluginTest.php
+++ b/tests/unit/Swift/Plugins/AntiFloodPluginTest.php
@@ -52,7 +52,7 @@ class Swift_Plugins_AntiFloodPluginTest extends \PHPUnit\Framework\TestCase
 
     public function testPluginCanSleepDuringRestart()
     {
-        $sleeper = $this->getMockBuilder('Swift_Plugins_Sleeper')->getMock();
+        $sleeper = $this->createMock('Swift_Plugins_Sleeper');
         $sleeper->expects($this->once())
                 ->method('sleep')
                 ->with(10);
@@ -73,14 +73,12 @@ class Swift_Plugins_AntiFloodPluginTest extends \PHPUnit\Framework\TestCase
 
     private function createTransport()
     {
-        return $this->getMockBuilder('Swift_Transport')->getMock();
+        return $this->createMock('Swift_Transport');
     }
 
     private function createSendEvent($transport)
     {
-        $evt = $this->getMockBuilder('Swift_Events_SendEvent')
-                    ->disableOriginalConstructor()
-                    ->getMock();
+        $evt = $this->createMock('Swift_Events_SendEvent');
         $evt->expects($this->any())
             ->method('getSource')
             ->willReturn($transport);
diff --git a/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php b/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php
index 836ae53..2c81cee 100644
--- a/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php
+++ b/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php
@@ -71,9 +71,7 @@ class Swift_Plugins_BandwidthMonitorPluginTest extends \PHPUnit\Framework\TestCa
 
     private function createSendEvent($message)
     {
-        $evt = $this->getMockBuilder('Swift_Events_SendEvent')
-                    ->disableOriginalConstructor()
-                    ->getMock();
+        $evt = $this->createMock('Swift_Events_SendEvent');
         $evt->expects($this->any())
             ->method('getMessage')
             ->willReturn($message);
@@ -83,9 +81,7 @@ class Swift_Plugins_BandwidthMonitorPluginTest extends \PHPUnit\Framework\TestCa
 
     private function createCommandEvent($command)
     {
-        $evt = $this->getMockBuilder('Swift_Events_CommandEvent')
-                    ->disableOriginalConstructor()
-                    ->getMock();
+        $evt = $this->createMock('Swift_Events_CommandEvent');
         $evt->expects($this->any())
             ->method('getCommand')
             ->willReturn($command);
@@ -95,9 +91,7 @@ class Swift_Plugins_BandwidthMonitorPluginTest extends \PHPUnit\Framework\TestCa
 
     private function createResponseEvent($response)
     {
-        $evt = $this->getMockBuilder('Swift_Events_ResponseEvent')
-                    ->disableOriginalConstructor()
-                    ->getMock();
+        $evt = $this->createMock('Swift_Events_ResponseEvent');
         $evt->expects($this->any())
             ->method('getResponse')
             ->willReturn($response);
@@ -108,7 +102,7 @@ class Swift_Plugins_BandwidthMonitorPluginTest extends \PHPUnit\Framework\TestCa
     private function createMessageWithByteCount($bytes)
     {
         $this->bytes = $bytes;
-        $msg = $this->getMockBuilder('Swift_Mime_SimpleMessage')->disableOriginalConstructor()->getMock();
+        $msg = $this->createMock('Swift_Mime_SimpleMessage');
         $msg->expects($this->any())
             ->method('toByteStream')
             ->willReturnCallback([$this, 'write']);
diff --git a/tests/unit/Swift/Plugins/LoggerPluginTest.php b/tests/unit/Swift/Plugins/LoggerPluginTest.php
index 0bedb65..ae5112b 100644
--- a/tests/unit/Swift/Plugins/LoggerPluginTest.php
+++ b/tests/unit/Swift/Plugins/LoggerPluginTest.php
@@ -125,7 +125,7 @@ class Swift_Plugins_LoggerPluginTest extends \SwiftMailerTestCase
 
     private function createLogger()
     {
-        return $this->getMockBuilder('Swift_Plugins_Logger')->getMock();
+        return $this->createMock('Swift_Plugins_Logger');
     }
 
     private function createPlugin($logger)
@@ -135,9 +135,7 @@ class Swift_Plugins_LoggerPluginTest extends \SwiftMailerTestCase
 
     private function createCommandEvent($command)
     {
-        $evt = $this->getMockBuilder('Swift_Events_CommandEvent')
-                    ->disableOriginalConstructor()
-                    ->getMock();
+        $evt = $this->createMock('Swift_Events_CommandEvent');
         $evt->expects($this->any())
             ->method('getCommand')
             ->willReturn($command);
@@ -147,9 +145,7 @@ class Swift_Plugins_LoggerPluginTest extends \SwiftMailerTestCase
 
     private function createResponseEvent($response)
     {
-        $evt = $this->getMockBuilder('Swift_Events_ResponseEvent')
-                    ->disableOriginalConstructor()
-                    ->getMock();
+        $evt = $this->createMock('Swift_Events_ResponseEvent');
         $evt->expects($this->any())
             ->method('getResponse')
             ->willReturn($response);
@@ -159,14 +155,12 @@ class Swift_Plugins_LoggerPluginTest extends \SwiftMailerTestCase
 
     private function createTransport()
     {
-        return $this->getMockBuilder('Swift_Transport')->getMock();
+        return $this->createMock('Swift_Transport');
     }
 
     private function createTransportChangeEvent()
     {
-        $evt = $this->getMockBuilder('Swift_Events_TransportChangeEvent')
-                    ->disableOriginalConstructor()
-                    ->getMock();
+        $evt = $this->createMock('Swift_Events_TransportChangeEvent');
         $evt->expects($this->any())
             ->method('getSource')
             ->willReturn($this->createTransport());
@@ -176,9 +170,7 @@ class Swift_Plugins_LoggerPluginTest extends \SwiftMailerTestCase
 
     public function createTransportExceptionEvent()
     {
-        $evt = $this->getMockBuilder('Swift_Events_TransportExceptionEvent')
-                    ->disableOriginalConstructor()
-                    ->getMock();
+        $evt = $this->createMock('Swift_Events_TransportExceptionEvent');
         $evt->expects($this->any())
             ->method('getException')
             ->willReturn(new Swift_TransportException(''));
diff --git a/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php b/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php
index 16931bb..a6b987d 100644
--- a/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php
+++ b/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php
@@ -71,14 +71,12 @@ class Swift_Plugins_PopBeforeSmtpPluginTest extends \PHPUnit\Framework\TestCase
 
     private function createTransport()
     {
-        return $this->getMockBuilder('Swift_Transport')->getMock();
+        return $this->createMock('Swift_Transport');
     }
 
     private function createTransportChangeEvent($transport)
     {
-        $evt = $this->getMockBuilder('Swift_Events_TransportChangeEvent')
-                    ->disableOriginalConstructor()
-                    ->getMock();
+        $evt = $this->createMock('Swift_Events_TransportChangeEvent');
         $evt->expects($this->any())
             ->method('getSource')
             ->willReturn($transport);
@@ -91,7 +89,7 @@ class Swift_Plugins_PopBeforeSmtpPluginTest extends \PHPUnit\Framework\TestCase
 
     public function createConnection()
     {
-        return $this->getMockBuilder('Swift_Plugins_Pop_Pop3Connection')->getMock();
+        return $this->createMock('Swift_Plugins_Pop_Pop3Connection');
     }
 
     public function createPlugin($host, $port, $crypto = null)
diff --git a/tests/unit/Swift/Plugins/RedirectingPluginTest.php b/tests/unit/Swift/Plugins/RedirectingPluginTest.php
index 721ff9b..7334010 100644
--- a/tests/unit/Swift/Plugins/RedirectingPluginTest.php
+++ b/tests/unit/Swift/Plugins/RedirectingPluginTest.php
@@ -171,9 +171,7 @@ class Swift_Plugins_RedirectingPluginTest extends \PHPUnit\Framework\TestCase
 
     private function createSendEvent(Swift_Mime_SimpleMessage $message)
     {
-        $evt = $this->getMockBuilder('Swift_Events_SendEvent')
-                    ->disableOriginalConstructor()
-                    ->getMock();
+        $evt = $this->createMock('Swift_Events_SendEvent');
         $evt->expects($this->any())
             ->method('getMessage')
             ->willReturn($message);
diff --git a/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php b/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php
index cf94617..1cc69b1 100644
--- a/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php
+++ b/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php
@@ -8,7 +8,7 @@ class Swift_Plugins_Reporters_HitReporterTest extends \PHPUnit\Framework\TestCas
     protected function setUp(): void
     {
         $this->hitReporter = new Swift_Plugins_Reporters_HitReporter();
-        $this->message = $this->getMockBuilder('Swift_Mime_SimpleMessage')->disableOriginalConstructor()->getMock();
+        $this->message = $this->createMock('Swift_Mime_SimpleMessage');
     }
 
     public function testReportingFail()
diff --git a/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php b/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php
index 4aa64f5..79ea1f3 100644
--- a/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php
+++ b/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php
@@ -8,7 +8,7 @@ class Swift_Plugins_Reporters_HtmlReporterTest extends \PHPUnit\Framework\TestCa
     protected function setUp(): void
     {
         $this->html = new Swift_Plugins_Reporters_HtmlReporter();
-        $this->message = $this->getMockBuilder('Swift_Mime_SimpleMessage')->disableOriginalConstructor()->getMock();
+        $this->message = $this->createMock('Swift_Mime_SimpleMessage');
     }
 
     public function testReportingPass()
diff --git a/tests/unit/Swift/Transport/StreamBufferTest.php b/tests/unit/Swift/Transport/StreamBufferTest.php
index 7a9d228..2ea0d3a 100644
--- a/tests/unit/Swift/Transport/StreamBufferTest.php
+++ b/tests/unit/Swift/Transport/StreamBufferTest.php
@@ -33,11 +33,11 @@ class Swift_Transport_StreamBufferTest extends \PHPUnit\Framework\TestCase
 
     private function createFactory()
     {
-        return $this->getMockBuilder('Swift_ReplacementFilterFactory')->getMock();
+        return $this->createMock('Swift_ReplacementFilterFactory');
     }
 
     public function createFilter()
     {
-        return $this->getMockBuilder('Swift_StreamFilter')->getMock();
+        return $this->createMock('Swift_StreamFilter');
     }
 }