@@ -53,7 +53,7 @@ protected function setUp() : void
53
53
$ this ->connection = DriverManager::getConnection ($ this ->params );
54
54
}
55
55
56
- public function getExecuteUpdateMockConnection ()
56
+ private function getExecuteUpdateMockConnection () : Connection
57
57
{
58
58
$ driverMock = $ this ->createMock (Driver::class);
59
59
@@ -63,10 +63,15 @@ public function getExecuteUpdateMockConnection()
63
63
$ this ->createMock (DriverConnection::class)
64
64
));
65
65
66
- return $ this ->getMockBuilder (Connection::class)
66
+ $ platform = $ this ->getMockForAbstractClass (AbstractPlatform::class);
67
+
68
+ /** @var Connection|MockObject $connection */
69
+ $ connection = $ this ->getMockBuilder (Connection::class)
67
70
->setMethods (['executeUpdate ' ])
68
- ->setConstructorArgs ([['platform ' => new Mocks \ MockPlatform () ], $ driverMock ])
71
+ ->setConstructorArgs ([['platform ' => $ platform ], $ driverMock ])
69
72
->getMock ();
73
+
74
+ return $ connection ;
70
75
}
71
76
72
77
public function testIsConnected ()
@@ -153,9 +158,8 @@ public function testConnectDispatchEvent()
153
158
$ driverMock = $ this ->createMock (Driver::class);
154
159
$ driverMock ->expects ($ this ->at (0 ))
155
160
->method ('connect ' );
156
- $ platform = new Mocks \MockPlatform ();
157
161
158
- $ conn = new Connection ([' platform ' => $ platform ], $ driverMock , new Configuration (), $ eventManager );
162
+ $ conn = new Connection ([], $ driverMock , new Configuration (), $ eventManager );
159
163
$ conn ->connect ();
160
164
}
161
165
@@ -249,7 +253,7 @@ public function testConnectStartsTransactionInNoAutoCommitMode()
249
253
->will ($ this ->returnValue (
250
254
$ this ->createMock (DriverConnection::class)
251
255
));
252
- $ conn = new Connection ([' platform ' => new Mocks \ MockPlatform () ], $ driverMock );
256
+ $ conn = new Connection ([], $ driverMock );
253
257
254
258
$ conn ->setAutoCommit (false );
255
259
@@ -271,7 +275,7 @@ public function testCommitStartsTransactionInNoAutoCommitMode()
271
275
->will ($ this ->returnValue (
272
276
$ this ->createMock (DriverConnection::class)
273
277
));
274
- $ conn = new Connection ([' platform ' => new Mocks \ MockPlatform () ], $ driverMock );
278
+ $ conn = new Connection ([], $ driverMock );
275
279
276
280
$ conn ->setAutoCommit (false );
277
281
$ conn ->connect ();
@@ -291,7 +295,7 @@ public function testRollBackStartsTransactionInNoAutoCommitMode()
291
295
->will ($ this ->returnValue (
292
296
$ this ->createMock (DriverConnection::class)
293
297
));
294
- $ conn = new Connection ([' platform ' => new Mocks \ MockPlatform () ], $ driverMock );
298
+ $ conn = new Connection ([], $ driverMock );
295
299
296
300
$ conn ->setAutoCommit (false );
297
301
$ conn ->connect ();
@@ -311,7 +315,7 @@ public function testSwitchingAutoCommitModeCommitsAllCurrentTransactions()
311
315
->will ($ this ->returnValue (
312
316
$ this ->createMock (DriverConnection::class)
313
317
));
314
- $ conn = new Connection ([' platform ' => new Mocks \ MockPlatform () ], $ driverMock );
318
+ $ conn = new Connection ([], $ driverMock );
315
319
316
320
$ conn ->connect ();
317
321
$ conn ->beginTransaction ();
@@ -520,7 +524,7 @@ public function testFetchAssoc()
520
524
/** @var Connection|MockObject $conn */
521
525
$ conn = $ this ->getMockBuilder (Connection::class)
522
526
->setMethods (['executeQuery ' ])
523
- ->setConstructorArgs ([[' platform ' => new Mocks \ MockPlatform () ], $ driverMock ])
527
+ ->setConstructorArgs ([[], $ driverMock ])
524
528
->getMock ();
525
529
526
530
$ conn ->expects ($ this ->once ())
@@ -556,7 +560,7 @@ public function testFetchArray()
556
560
/** @var Connection|MockObject $conn */
557
561
$ conn = $ this ->getMockBuilder (Connection::class)
558
562
->setMethods (['executeQuery ' ])
559
- ->setConstructorArgs ([[' platform ' => new Mocks \ MockPlatform () ], $ driverMock ])
563
+ ->setConstructorArgs ([[], $ driverMock ])
560
564
->getMock ();
561
565
562
566
$ conn ->expects ($ this ->once ())
@@ -593,7 +597,7 @@ public function testFetchColumn()
593
597
/** @var Connection|MockObject $conn */
594
598
$ conn = $ this ->getMockBuilder (Connection::class)
595
599
->setMethods (['executeQuery ' ])
596
- ->setConstructorArgs ([[' platform ' => new Mocks \ MockPlatform () ], $ driverMock ])
600
+ ->setConstructorArgs ([[], $ driverMock ])
597
601
->getMock ();
598
602
599
603
$ conn ->expects ($ this ->once ())
@@ -628,7 +632,7 @@ public function testFetchAll()
628
632
/** @var Connection|MockObject $conn */
629
633
$ conn = $ this ->getMockBuilder (Connection::class)
630
634
->setMethods (['executeQuery ' ])
631
- ->setConstructorArgs ([[' platform ' => new Mocks \ MockPlatform () ], $ driverMock ])
635
+ ->setConstructorArgs ([[], $ driverMock ])
632
636
->getMock ();
633
637
634
638
$ conn ->expects ($ this ->once ())
@@ -694,8 +698,8 @@ public function dataCallConnectOnce()
694
698
public function testCallConnectOnce ($ method , $ params )
695
699
{
696
700
$ driverMock = $ this ->createMock (Driver::class);
697
- $ pdoMock = $ this ->createMock (\ Doctrine \ DBAL \ Driver \ Connection::class);
698
- $ platformMock = new Mocks \ MockPlatform ( );
701
+ $ pdoMock = $ this ->createMock (Connection::class);
702
+ $ platformMock = $ this -> createMock (AbstractPlatform::class );
699
703
$ stmtMock = $ this ->createMock (Statement::class);
700
704
701
705
$ pdoMock ->expects ($ this ->any ())
0 commit comments