1414use OxidEsales \DoctrineMigrationWrapper \MigrationAvailabilityChecker ;
1515use OxidEsales \DoctrineMigrationWrapper \Migrations ;
1616use OxidEsales \DoctrineMigrationWrapper \MigrationsPathProvider ;
17- use OxidEsales \Facts \Facts ;
1817use PHPUnit \Framework \Attributes \DataProvider ;
1918use PHPUnit \Framework \MockObject \MockObject ;
2019use PHPUnit \Framework \TestCase ;
@@ -133,7 +132,7 @@ public function testExecuteAllMigrations(): void
133132 );
134133
135134 $ doctrineApplication ->method ('get ' )
136- ->willReturn ($ this ->createMock (Command::class));
135+ ->willReturn ($ this ->createStub (Command::class));
137136
138137 $ doctrineApplicationBuilder = $ this ->getDoctrineApplicationBuilderStub ($ doctrineApplication );
139138
@@ -170,7 +169,7 @@ public function testExecuteOnlyRequestedMigration(): void
170169 $ doctrineApplication = $ this ->createPartialMock (Application::class, ['run ' , 'get ' ]);
171170 $ doctrineApplication ->expects ($ this ->once ())->method ('run ' )->with ($ inputEE );
172171 $ doctrineApplication ->method ('get ' )
173- ->willReturn ($ this ->createMock (Command::class));
172+ ->willReturn ($ this ->createStub (Command::class));
174173
175174 $ doctrineApplicationBuilder = $ this ->getDoctrineApplicationBuilderStub ($ doctrineApplication );
176175
@@ -371,7 +370,7 @@ public function testExecuteMigrationWithFlags(): void
371370 $ doctrineApplication = $ this ->createPartialMock (Application::class, ['run ' , 'get ' ]);
372371 $ doctrineApplication ->expects ($ this ->once ())->method ('run ' )->with ($ inputEE );
373372 $ doctrineApplication ->method ('get ' )
374- ->willReturn ($ this ->createMock (Command::class));
373+ ->willReturn ($ this ->createStub (Command::class));
375374
376375 $ doctrineApplicationBuilder = $ this ->getDoctrineApplicationBuilderStub ($ doctrineApplication );
377376
@@ -481,7 +480,7 @@ private function getDoctrineMock($runsAtLeastOnce, $callWith = null): MockObject
481480 return $ doctrineApplication ;
482481 }
483482 $ doctrineApplication ->method ('get ' )
484- ->willReturn ($ this ->createMock (Command::class));
483+ ->willReturn ($ this ->createStub (Command::class));
485484 if ($ callWith ) {
486485 $ doctrineApplication ->expects ($ this ->atLeastOnce ())->method ('run ' )->with ($ callWith );
487486 } else {
@@ -491,43 +490,43 @@ private function getDoctrineMock($runsAtLeastOnce, $callWith = null): MockObject
491490 return $ doctrineApplication ;
492491 }
493492
494- private function getDoctrineStub ($ result = null ): MockObject
493+ private function getDoctrineStub ($ result = null ): Application
495494 {
496- $ doctrineApplication = $ this ->createPartialMock (Application::class, [ ' run ' , ' get ' ] );
495+ $ doctrineApplication = $ this ->createStub (Application::class);
497496 $ doctrineApplication ->method ('run ' )->willReturn ($ result ? 1 : 0 );
498497 $ doctrineApplication ->method ('get ' )
499- ->willReturn ($ this ->createMock (Command::class));
498+ ->willReturn ($ this ->createStub (Command::class));
500499
501500 return $ doctrineApplication ;
502501 }
503502
504- private function getDoctrineApplicationBuilderStub ($ doctrineApplication ): MockObject
503+ private function getDoctrineApplicationBuilderStub ($ doctrineApplication ): DoctrineApplicationBuilder
505504 {
506- $ doctrineApplicationBuilder = $ this ->createPartialMock (DoctrineApplicationBuilder::class, ['build ' ]);
507- $ doctrineApplicationBuilder ->method ('build ' )->willReturn ($ doctrineApplication );
505+ $ doctrineApplicationBuilder = $ this ->createStub (DoctrineApplicationBuilder::class);
506+ $ doctrineApplicationBuilder
507+ ->method ('build ' )
508+ ->willReturn ($ doctrineApplication );
508509
509510 return $ doctrineApplicationBuilder ;
510511 }
511512
512- private function getMigrationsPathProviderStub ($ migrationPaths ): MockObject
513+ private function getMigrationsPathProviderStub ($ migrationPaths ): MigrationsPathProvider
513514 {
514- $ migrationsPathProvider = $ this ->getMockBuilder (MigrationsPathProvider::class)
515- ->onlyMethods (['getMigrationsPath ' ])
516- ->setConstructorArgs ([new Facts ()])
517- ->getMock ();
515+ $ migrationsPathProvider = $ this ->createStub (MigrationsPathProvider::class);
518516
519- $ migrationsPathProvider ->method ('getMigrationsPath ' )->willReturn ($ migrationPaths );
517+ $ migrationsPathProvider
518+ ->method ('getMigrationsPath ' )
519+ ->willReturn ($ migrationPaths );
520520
521521 return $ migrationsPathProvider ;
522522 }
523523
524- private function getMigrationAvailabilityStub ($ ifMigrationsAvailable ): MockObject
524+ private function getMigrationAvailabilityStub ($ ifMigrationsAvailable ): MigrationAvailabilityChecker
525525 {
526- $ migrationAvailabilityChecker = $ this ->createPartialMock (
527- MigrationAvailabilityChecker::class,
528- ['migrationExists ' ]
529- );
530- $ migrationAvailabilityChecker ->method ('migrationExists ' )->willReturn ($ ifMigrationsAvailable );
526+ $ migrationAvailabilityChecker = $ this ->createStub (MigrationAvailabilityChecker::class);
527+ $ migrationAvailabilityChecker
528+ ->method ('migrationExists ' )
529+ ->willReturn ($ ifMigrationsAvailable );
531530
532531 return $ migrationAvailabilityChecker ;
533532 }
0 commit comments