|
13 | 13 | use Composer\Json\JsonFile;
|
14 | 14 | use org\bovigo\vfs\vfsStream;
|
15 | 15 | use org\bovigo\vfs\vfsStreamDirectory;
|
16 |
| -use PHPUnit\Framework\MockObject\MockObject; |
| 16 | +use PHPUnit\Framework\Attributes\CoversMethod; |
| 17 | +use PHPUnit\Framework\Attributes\DataProvider; |
| 18 | +use PHPUnit\Framework\MockObject\Exception; |
17 | 19 | use PHPUnit\Framework\TestCase;
|
18 | 20 | use Youwe\FileMapping\FileMappingInterface;
|
19 | 21 | use Youwe\FileMapping\FileMappingReaderInterface;
|
20 | 22 | use Youwe\TestingSuite\Composer\Installer\ArchiveExcludeInstaller;
|
21 | 23 | use Youwe\TestingSuite\Composer\MappingResolver;
|
22 | 24 |
|
23 | 25 | /**
|
24 |
| - * @coversDefaultClass \Youwe\TestingSuite\Composer\Installer\ArchiveExcludeInstaller |
25 |
| - * @SuppressWarnings(PHPMD) |
| 26 | + * @phpcs:disable GlobalPhpUnit.Coverage.CoversTag.CoversTagMissing |
26 | 27 | */
|
| 28 | +#[CoversMethod(ArchiveExcludeInstaller::class, '__construct')] |
| 29 | +#[CoversMethod(ArchiveExcludeInstaller::class, 'install')] |
27 | 30 | class ArchiveExcludeInstallerTest extends TestCase
|
28 | 31 | {
|
29 | 32 | /**
|
30 |
| - * @param array $existingFiles |
31 |
| - * @param array $files |
32 |
| - * @param array $defaults |
33 |
| - * @param array $definition |
34 |
| - * @param array $expected |
35 |
| - * |
36 |
| - * @return void |
37 |
| - * |
38 |
| - * @dataProvider dataProvider |
39 |
| - * |
40 |
| - * @covers ::__construct |
41 |
| - * @covers ::install |
| 33 | + * @throws Exception |
42 | 34 | */
|
| 35 | + #[DataProvider('dataProvider')] |
43 | 36 | public function testInstall(
|
44 | 37 | array $existingFiles,
|
45 | 38 | array $files,
|
46 | 39 | array $defaults,
|
47 | 40 | array $definition,
|
48 | 41 | array $expected
|
49 |
| - ) { |
| 42 | + ): void { |
50 | 43 | $file = $this->createMock(JsonFile::class);
|
51 | 44 | $resolver = $this->createMock(MappingResolver::class);
|
52 | 45 | $io = $this->createMock(IOInterface::class);
|
@@ -79,10 +72,7 @@ public function testInstall(
|
79 | 72 | $installer->install();
|
80 | 73 | }
|
81 | 74 |
|
82 |
| - /** |
83 |
| - * @return array |
84 |
| - */ |
85 |
| - public function dataProvider(): array |
| 75 | + public static function dataProvider(): array |
86 | 76 | {
|
87 | 77 | return [
|
88 | 78 | [
|
@@ -122,21 +112,17 @@ public function dataProvider(): array
|
122 | 112 | }
|
123 | 113 |
|
124 | 114 | /**
|
125 |
| - * @param array $files |
126 |
| - * |
127 |
| - * @return FileMappingReaderInterface |
| 115 | + * @throws Exception |
128 | 116 | */
|
129 | 117 | private function createReaderMock(array $files): FileMappingReaderInterface
|
130 | 118 | {
|
131 |
| - /** @var FileMappingReaderInterface|MockObject $mock */ |
132 | 119 | $mock = $this->createMock(FileMappingReaderInterface::class);
|
133 | 120 |
|
134 | 121 | $valids = array_fill(0, count($files), true);
|
135 | 122 | $valids[] = false;
|
136 | 123 |
|
137 | 124 | $mappings = array_map(
|
138 | 125 | function (string $file): FileMappingInterface {
|
139 |
| - /** @var FileMappingInterface|MockObject $mapping */ |
140 | 126 | $mapping = $this->createMock(FileMappingInterface::class);
|
141 | 127 | $mapping
|
142 | 128 | ->expects(self::any())
|
@@ -166,11 +152,6 @@ function (string $file): FileMappingInterface {
|
166 | 152 | return $mock;
|
167 | 153 | }
|
168 | 154 |
|
169 |
| - /** |
170 |
| - * @param array $files |
171 |
| - * |
172 |
| - * @return vfsStreamDirectory |
173 |
| - */ |
174 | 155 | private function createFilesystem(array $files): vfsStreamDirectory
|
175 | 156 | {
|
176 | 157 | return vfsStream::setup(
|
|
0 commit comments