diff --git a/tests/Doctrine/Tests/DBAL/ConnectionTest.php b/tests/Doctrine/Tests/DBAL/ConnectionTest.php index 7aa7725b129..fc018fcc072 100644 --- a/tests/Doctrine/Tests/DBAL/ConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/ConnectionTest.php @@ -144,9 +144,7 @@ public function testGetEventManager() : void public function testConnectDispatchEvent() : void { - $listenerMock = $this->getMockBuilder($this->getMockClass('ConnectDispatchEventListener')) - ->addMethods(['postConnect']) - ->getMock(); + $listenerMock = $this->createMock(ConnectDispatchEventListener::class); $listenerMock->expects($this->once())->method('postConnect'); $eventManager = new EventManager(); @@ -948,3 +946,8 @@ public function testExecuteCacheQueryStripsPlatformFromConnectionParamsBeforeGen $connection->executeCacheQuery($query, [], [], $queryCacheProfile); } } + +interface ConnectDispatchEventListener +{ + public function postConnect() : void; +} diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php index cc6084f644c..cf93304fae6 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php @@ -369,10 +369,7 @@ public function testListTableColumnsDispatchEvent() : void $this->schemaManager->dropAndCreateTable($table); - $listenerMock = $this->getMockBuilder($this->getMockClass('ListTableColumnsDispatchEventListener')) - ->addMethods(['onSchemaColumnDefinition']) - ->getMock(); - + $listenerMock = $this->createMock(ListTableColumnsDispatchEventListener::class); $listenerMock ->expects($this->exactly(7)) ->method('onSchemaColumnDefinition'); @@ -397,9 +394,7 @@ public function testListTableIndexesDispatchEvent() : void $this->schemaManager->dropAndCreateTable($table); - $listenerMock = $this->getMockBuilder($this->getMockClass('ListTableIndexesDispatchEventListener')) - ->addMethods(['onSchemaIndexDefinition']) - ->getMock(); + $listenerMock = $this->createMock(ListTableIndexesDispatchEventListener::class); $listenerMock ->expects($this->exactly(3)) ->method('onSchemaIndexDefinition'); @@ -1653,3 +1648,13 @@ public function testSchemaDiffForeignKeys() : void } } } + +interface ListTableColumnsDispatchEventListener +{ + public function onSchemaColumnDefinition() : void; +} + +interface ListTableIndexesDispatchEventListener +{ + public function onSchemaIndexDefinition() : void; +} diff --git a/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php b/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php index 6ae57373cc3..f90a8060608 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php @@ -372,9 +372,7 @@ public function testGetCustomColumnDeclarationSql() : void public function testGetCreateTableSqlDispatchEvent() : void { - $listenerMock = $this->getMockBuilder($this->getMockClass('GetCreateTableSqlDispatchEvenListener')) - ->addMethods(['onSchemaCreateTable', 'onSchemaCreateTableColumn']) - ->getMock(); + $listenerMock = $this->createMock(GetCreateTableSqlDispatchEventListener::class); $listenerMock ->expects($this->once()) ->method('onSchemaCreateTable'); @@ -396,9 +394,7 @@ public function testGetCreateTableSqlDispatchEvent() : void public function testGetDropTableSqlDispatchEvent() : void { - $listenerMock = $this->getMockBuilder($this->getMockClass('GetDropTableSqlDispatchEventListener')) - ->addMethods(['onSchemaDropTable']) - ->getMock(); + $listenerMock = $this->createMock(GetDropTableSqlDispatchEventListener::class); $listenerMock ->expects($this->once()) ->method('onSchemaDropTable'); @@ -413,17 +409,7 @@ public function testGetDropTableSqlDispatchEvent() : void public function testGetAlterTableSqlDispatchEvent() : void { - $events = [ - 'onSchemaAlterTable', - 'onSchemaAlterTableAddColumn', - 'onSchemaAlterTableRemoveColumn', - 'onSchemaAlterTableChangeColumn', - 'onSchemaAlterTableRenameColumn', - ]; - - $listenerMock = $this->getMockBuilder($this->getMockClass('GetAlterTableSqlDispatchEvenListener')) - ->addMethods($events) - ->getMock(); + $listenerMock = $this->createMock(GetAlterTableSqlDispatchEventListener::class); $listenerMock ->expects($this->once()) ->method('onSchemaAlterTable'); @@ -1532,3 +1518,28 @@ public function testZeroOffsetWithoutLimitIsIgnored() : void ); } } + +interface GetCreateTableSqlDispatchEventListener +{ + public function onSchemaCreateTable() : void; + + public function onSchemaCreateTableColumn() : void; +} + +interface GetAlterTableSqlDispatchEventListener +{ + public function onSchemaAlterTable() : void; + + public function onSchemaAlterTableAddColumn() : void; + + public function onSchemaAlterTableRemoveColumn() : void; + + public function onSchemaAlterTableChangeColumn() : void; + + public function onSchemaAlterTableRenameColumn() : void; +} + +interface GetDropTableSqlDispatchEventListener +{ + public function onSchemaDropTable() : void; +}