diff --git a/phpmon/Common/Helpers/VersionExtractor.swift b/phpmon/Common/Helpers/VersionExtractor.swift index 00e865b..324c896 100644 --- a/phpmon/Common/Helpers/VersionExtractor.swift +++ b/phpmon/Common/Helpers/VersionExtractor.swift @@ -40,5 +40,4 @@ class VersionExtractor { return nil } } - } diff --git a/tests/unit/Versions/ValetVersionExtractorTest.swift b/tests/unit/Versions/ValetVersionExtractorTest.swift index a36f334..395d2b4 100644 --- a/tests/unit/Versions/ValetVersionExtractorTest.swift +++ b/tests/unit/Versions/ValetVersionExtractorTest.swift @@ -10,6 +10,36 @@ import XCTest class ValetVersionExtractorTest: XCTestCase { + func test_can_determine_valet_version_regardless_of_deprecations() async { + let output = """ + Deprecated: Return type of Tightenco\\Collect\\Support\\Collection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/dummy/.composer/vendor/tightenco/collect/src/Collect/Support/Collection.php on line 1789 + + Deprecated: Return type of Tightenco\\Collect\\Support\\Collection::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/dummy/.composer/vendor/tightenco/collect/src/Collect/Support/Collection.php on line 1800 + + Deprecated: Return type of Tightenco\\Collect\\Support\\Collection::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/dummy/.composer/vendor/tightenco/collect/src/Collect/Support/Collection.php on line 1812 + + Deprecated: Return type of Tightenco\\Collect\\Support\\Collection::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/dummy/.composer/vendor/tightenco/collect/src/Collect/Support/Collection.php on line 1827 + + Deprecated: Return type of Tightenco\\Collect\\Support\\Collection::count() should either be compatible with Countable::count(): int, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/dummy/.composer/vendor/tightenco/collect/src/Collect/Support/Collection.php on line 1768 + + Deprecated: Return type of Tightenco\\Collect\\Support\\Collection::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/dummy/.composer/vendor/tightenco/collect/src/Collect/Support/Collection.php on line 1747 + + Deprecated: Return type of Tightenco\\Collect\\Support\\Collection::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/dummy/.composer/vendor/tightenco/collect/src/Collect/Support/Collection.php on line 1716 + Laravel Valet 3.3.0 + """ + + let versionString = output + .trimmingCharacters(in: .whitespacesAndNewlines) + .components(separatedBy: "Laravel Valet")[1] + .trimmingCharacters(in: .whitespaces) + + print(versionString) + + let version = try! VersionNumber.parse(VersionExtractor.from(versionString)!) + + XCTAssertEqual(version.major, 3) + } + func test_can_determine_valet_version() async { let version = await valet("--version", sudo: false) XCTAssert(version.contains("Laravel Valet 2") || version.contains("Laravel Valet 3"))