|
11 | 11 |
|
12 | 12 | namespace Symfony\Bundle\MakerBundle\Tests\Util;
|
13 | 13 |
|
| 14 | +use PHPUnit\Framework\MockObject\MockObject; |
14 | 15 | use PHPUnit\Framework\TestCase;
|
15 | 16 | use Symfony\Bundle\MakerBundle\FileManager;
|
16 | 17 | use Symfony\Bundle\MakerBundle\Util\PhpCompatUtil;
|
17 |
| -use Symfony\Component\HttpKernel\Kernel; |
18 | 18 |
|
19 | 19 | /**
|
20 | 20 | * @author Jesse Rushlow <[email protected]>
|
21 | 21 | */
|
22 |
| -class PhpVersionTest extends TestCase |
| 22 | +class PhpCompatUtilTest extends TestCase |
23 | 23 | {
|
24 |
| - /** |
25 |
| - * @dataProvider phpVersionDataProvider |
26 |
| - */ |
27 |
| - public function testUsesPhpPlatformFromComposerJsonFileForCanUseAttributes(string $version, bool $expectedResult): void |
28 |
| - { |
29 |
| - $this->markTestSkipped('This test needs to be refactored if we keep the util.'); |
30 |
| - $mockFileManager = $this->mockFileManager(sprintf('{"platform-overrides": {"php": "%s"}}', $version)); |
31 |
| - |
32 |
| - $version = new PhpCompatUtil($mockFileManager); |
33 |
| - |
34 |
| -// $result = $version->canUseAttributes(); |
35 |
| - |
36 |
| - /* |
37 |
| - * Symfony 5.2 is required to compare the result. Otherwise it will always |
38 |
| - * return false regardless of the PHP Version. If the test suite is run w/ |
39 |
| - * Symfony < 5.2, we assert false here but still rely on the assertions above. |
40 |
| - */ |
41 |
| - if (Kernel::VERSION_ID < 50200) { |
42 |
| - $expectedResult = false; |
43 |
| - } |
44 |
| - |
45 |
| - self::assertSame($expectedResult, $result); |
46 |
| - } |
47 |
| - |
48 |
| - public function phpVersionDataProvider(): \Generator |
49 |
| - { |
50 |
| - yield ['8', true]; |
51 |
| - yield ['8.0', true]; |
52 |
| - yield ['8.0.1', true]; |
53 |
| - yield ['8RC1', true]; |
54 |
| - yield ['8.1alpha1', true]; |
55 |
| - yield ['8.0.0beta2', true]; |
56 |
| - yield ['8beta', true]; |
57 |
| - yield ['7', false]; |
58 |
| - yield ['7.0', false]; |
59 |
| - yield ['7.1.1', false]; |
60 |
| - yield ['7.0.0RC3', false]; |
61 |
| - } |
62 |
| - |
63 | 24 | public function testFallBackToPhpVersionWithoutLockFile(): void
|
64 | 25 | {
|
65 | 26 | $mockFileManager = $this->createMock(FileManager::class);
|
@@ -99,10 +60,7 @@ public function testWithoutPlatformVersionSet(): void
|
99 | 60 | self::assertSame(\PHP_VERSION, $result);
|
100 | 61 | }
|
101 | 62 |
|
102 |
| - /** |
103 |
| - * @return \PHPUnit\Framework\MockObject\MockObject|FileManager |
104 |
| - */ |
105 |
| - private function mockFileManager(string $json) |
| 63 | + private function mockFileManager(string $json): MockObject|FileManager |
106 | 64 | {
|
107 | 65 | $mockFileManager = $this->createMock(FileManager::class);
|
108 | 66 | $mockFileManager
|
|
0 commit comments