|
15 | 15 | use Composer\Installer\InstallationManager; |
16 | 16 | use Composer\IO\IOInterface; |
17 | 17 | use Composer\Package\PackageInterface; |
| 18 | +use PHPUnit\Framework\Attributes\DataProvider; |
18 | 19 | use PHPUnit\Framework\TestCase; |
19 | 20 | use Symfony\Flex\Configurator\CopyFromPackageConfigurator; |
20 | 21 | use Symfony\Flex\Lock; |
@@ -57,9 +58,7 @@ public function testConfigureDirectory() |
57 | 58 | } |
58 | 59 | } |
59 | 60 |
|
60 | | - /** |
61 | | - * @dataProvider providerTestConfigureDirectoryWithExistingFiles |
62 | | - */ |
| 61 | + #[DataProvider('providerTestConfigureDirectoryWithExistingFiles')] |
63 | 62 | public function testConfigureDirectoryWithExistingFiles(bool $force, string $sourceFileContent, string $existingTargetFileContent, string $expectedFinalTargetFileContent) |
64 | 63 | { |
65 | 64 | if (!is_dir($this->sourceDirectory)) { |
@@ -93,7 +92,7 @@ public function testConfigureDirectoryWithExistingFiles(bool $force, string $sou |
93 | 92 | } |
94 | 93 | } |
95 | 94 |
|
96 | | - public function providerTestConfigureDirectoryWithExistingFiles(): array |
| 95 | + public static function providerTestConfigureDirectoryWithExistingFiles(): array |
97 | 96 | { |
98 | 97 | return [ |
99 | 98 | [true, 'NEW_CONTENT', 'OLD_CONTENT', 'NEW_CONTENT'], |
@@ -166,16 +165,16 @@ protected function setUp(): void |
166 | 165 |
|
167 | 166 | $package = $this->getMockBuilder(PackageInterface::class)->getMock(); |
168 | 167 | $this->recipe = $this->getMockBuilder(Recipe::class)->disableOriginalConstructor()->getMock(); |
169 | | - $this->recipe->expects($this->exactly(1))->method('getPackage')->willReturn($package); |
| 168 | + $this->recipe->expects($this->once())->method('getPackage')->willReturn($package); |
170 | 169 |
|
171 | 170 | $installationManager = $this->getMockBuilder(InstallationManager::class)->disableOriginalConstructor()->getMock(); |
172 | | - $installationManager->expects($this->exactly(1)) |
| 171 | + $installationManager->expects($this->once()) |
173 | 172 | ->method('getInstallPath') |
174 | 173 | ->with($package) |
175 | 174 | ->willReturn(FLEX_TEST_DIR) |
176 | 175 | ; |
177 | 176 | $this->composer = $this->getMockBuilder(Composer::class)->getMock(); |
178 | | - $this->composer->expects($this->exactly(1)) |
| 177 | + $this->composer->expects($this->once()) |
179 | 178 | ->method('getInstallationManager') |
180 | 179 | ->willReturn($installationManager) |
181 | 180 | ; |
|
0 commit comments