1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2026-03-28 15:00:06 +01:00

Fix tests related to version number parsing

This commit is contained in:
2023-01-05 17:58:55 +01:00
parent 67e8589834
commit d854dee2a1
3 changed files with 34 additions and 31 deletions

View File

@@ -11,18 +11,23 @@ import XCTest
class PhpVersionDetectionTest: XCTestCase {
func test_can_detect_valid_php_versions() async throws {
let outcome = await PhpEnv.shared.extractPhpVersions(from: [
"", // empty lines should be omitted
"php@8.0",
"php@8.0", // should only be detected once
"meta-php@8.0", // should be omitted, invalid
"php@8.0-coolio", // should be omitted, invalid
"php@7.0",
"",
"unrelatedphp@1.0", // should be omitted, invalid
"php@5.6",
"php@5.4" // should be omitted, not supported
], checkBinaries: false, generateHelpers: false)
let outcome = await PhpEnv.shared.extractPhpVersions(
from: [
"", // empty lines should be omitted
"php@8.0",
"php@8.0", // should only be detected once
"meta-php@8.0", // should be omitted, invalid
"php@8.0-coolio", // should be omitted, invalid
"php@7.0",
"",
"unrelatedphp@1.0", // should be omitted, invalid
"php@5.6", // should be omitted, not supported
"php@5.4" // should be omitted, not supported
],
supported: ["7.0", "8.0", "8.1", "8.2"],
checkBinaries: false,
generateHelpers: false
)
XCTAssertEqual(outcome, ["8.0", "7.0"])
}