88use Doctrine \Migrations \AbstractMigration ;
99use Doctrine \Migrations \Exception \MigrationClassNotFound ;
1010use Doctrine \Migrations \Version \Version ;
11+ use PHPUnit \Framework \Attributes \TestWith ;
1112use PHPUnit \Framework \TestCase ;
1213use Symfony \Contracts \Service \ServiceProviderInterface ;
1314
1415class ServiceMigrationsRepositoryTest extends TestCase
1516{
16- /**
17- * @testWith [true]
18- * [false]
19- */
17+ #[TestWith([true ])]
18+ #[TestWith([false ])]
2019 public function testHasMigration (bool $ expectedResult ): void
2120 {
22- $ container = $ this -> createMock (ServiceProviderInterface::class);
21+ $ container = self :: createStub (ServiceProviderInterface::class);
2322 $ container ->method ('has ' )
2423 ->with ('Version001 ' )
2524 ->willReturn ($ expectedResult );
@@ -31,9 +30,9 @@ public function testHasMigration(bool $expectedResult): void
3130
3231 public function testGetMigrationReturnsAvailableMigration (): void
3332 {
34- $ migration = $ this -> createMock (AbstractMigration::class);
33+ $ migration = self :: createStub (AbstractMigration::class);
3534
36- $ container = $ this -> createMock (ServiceProviderInterface::class);
35+ $ container = self :: createStub (ServiceProviderInterface::class);
3736 $ container ->method ('has ' )
3837 ->with ('Version001 ' )
3938 ->willReturn (true );
@@ -52,7 +51,7 @@ public function testGetMigrationReturnsAvailableMigration(): void
5251
5352 public function testGetMigrationThrowsExceptionWhenMigrationNotFound (): void
5453 {
55- $ container = $ this -> createMock (ServiceProviderInterface::class);
54+ $ container = self :: createStub (ServiceProviderInterface::class);
5655 $ container ->method ('has ' )
5756 ->with ('NonExistentVersion ' )
5857 ->willReturn (false );
@@ -67,10 +66,10 @@ public function testGetMigrationThrowsExceptionWhenMigrationNotFound(): void
6766
6867 public function testGetMigrationsReturnsAvailableMigrationsSet (): void
6968 {
70- $ migration1 = $ this -> createMock (AbstractMigration::class);
71- $ migration2 = $ this -> createMock (AbstractMigration::class);
69+ $ migration1 = self :: createStub (AbstractMigration::class);
70+ $ migration2 = self :: createStub (AbstractMigration::class);
7271
73- $ container = $ this -> createMock (ServiceProviderInterface::class);
72+ $ container = self :: createStub (ServiceProviderInterface::class);
7473 $ container ->method ('getProvidedServices ' )
7574 ->willReturn (['Version001 ' , 'Version002 ' ]);
7675 $ container ->method ('has ' )
0 commit comments