|
57 | 57 | final class PhpBinaryPathTest extends TestCase |
58 | 58 | { |
59 | 59 | private const FAKE_PHP_EXECUTABLE = __DIR__ . '/../../../assets/fake-php.sh'; |
| 60 | + private const PHP_INVALID_VERSION = __DIR__ . '/../../../assets/fake-php-invalid-version.sh'; |
60 | 61 | private const VALID_PHP_WITH_WARNINGS = __DIR__ . '/../../../assets/valid-php-with-warnings.sh'; |
61 | 62 |
|
62 | 63 | public function testNonExistentPhpBinaryIsRejected(): void |
@@ -92,6 +93,13 @@ public function testInvalidPhpBinaryIsRejected(): void |
92 | 93 | PhpBinaryPath::fromPhpBinaryPath(self::FAKE_PHP_EXECUTABLE); |
93 | 94 | } |
94 | 95 |
|
| 96 | + public function testInvalidVersion(): void |
| 97 | + { |
| 98 | + $phpBinary = PhpBinaryPath::fromPhpBinaryPath(self::PHP_INVALID_VERSION); |
| 99 | + self::assertSame('5.6.40', $phpBinary->version()); |
| 100 | + self::assertSame('5.6', $phpBinary->majorMinorVersion()); |
| 101 | + } |
| 102 | + |
95 | 103 | public function testWarningsAndDeprecationsAreFiltered(): void |
96 | 104 | { |
97 | 105 | if (Platform::isWindows()) { |
@@ -129,11 +137,17 @@ public static function phpConfigPathProvider(): array |
129 | 137 |
|
130 | 138 | $possiblePhpConfigPaths = array_filter( |
131 | 139 | [ |
| 140 | + ['/usr/bin/php-config8.5', '8.5'], |
| 141 | + ['/usr/bin/php-config8.4', '8.4'], |
132 | 142 | ['/usr/bin/php-config8.3', '8.3'], |
133 | 143 | ['/usr/bin/php-config8.2', '8.2'], |
134 | 144 | ['/usr/bin/php-config8.1', '8.1'], |
135 | 145 | ['/usr/bin/php-config8.0', '8.0'], |
136 | 146 | ['/usr/bin/php-config7.4', '7.4'], |
| 147 | + ['/usr/bin/php-config7.3', '7.3'], |
| 148 | + ['/usr/bin/php-config7.2', '7.2'], |
| 149 | + ['/usr/bin/php-config7.1', '7.1'], |
| 150 | + ['/usr/bin/php-config5.6', '5.6'], |
137 | 151 | ], |
138 | 152 | static fn (array $phpConfigPath) => file_exists($phpConfigPath[0]) |
139 | 153 | && is_executable($phpConfigPath[0]), |
@@ -168,6 +182,11 @@ public function testFromPhpConfigExecutable(string $phpConfigPath, string $expec |
168 | 182 | $phpBinary->majorMinorVersion(), |
169 | 183 | ); |
170 | 184 |
|
| 185 | + self::assertStringStartsWith( |
| 186 | + $expectedMajorMinor . '.', |
| 187 | + $phpBinary->version(), |
| 188 | + ); |
| 189 | + |
171 | 190 | self::assertSame($phpConfigPath, $phpBinary->phpConfigPath()); |
172 | 191 | } |
173 | 192 |
|
|
0 commit comments