mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-08 04:20:07 +02:00
🐛 Correctly parse RC PHP version (#132)
It'll be a while before a new release candidate is available, but this bug has now been resolved. A new `PhpVersionNumber.parse` method has been added which can throw. The `VersionExtractor` class is now capable of extracting version numbers from all strings now too, and isn't just used to determine the Valet version number. New tests have been added to handle these scenarios. This commit also removes the phpmon-cli component, which wasn't being updated or maintained (it was an experiment).
This commit is contained in:
@ -11,6 +11,10 @@ import XCTest
|
||||
class PhpVersionNumberTest: XCTestCase {
|
||||
|
||||
func testCanDeconstructPhpVersion() throws {
|
||||
XCTAssertEqual(
|
||||
try! PhpVersionNumber.parse("PHP 8.1.0RC5-dev"),
|
||||
PhpVersionNumber(major: 8, minor: 1, patch: 0)
|
||||
)
|
||||
XCTAssertEqual(
|
||||
PhpVersionNumber.make(from: "8.0.11"),
|
||||
PhpVersionNumber(major: 8, minor: 0, patch: 11)
|
||||
@ -29,6 +33,12 @@ class PhpVersionNumberTest: XCTestCase {
|
||||
)
|
||||
}
|
||||
|
||||
func testPhpVersionNumberParse() throws {
|
||||
XCTAssertThrowsError(try PhpVersionNumber.parse("OOF")) { error in
|
||||
XCTAssertTrue(error is VersionParseError)
|
||||
}
|
||||
}
|
||||
|
||||
func testCanCheckFixedConstraints() throws {
|
||||
XCTAssertEqual(
|
||||
PhpVersionNumberCollection
|
||||
|
Reference in New Issue
Block a user