1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-07 20:10:08 +02:00

🏗 WIP: Parsing version updates

This commit is contained in:
2023-03-17 20:38:21 +01:00
parent 7e04f8b881
commit 8f1304308d
6 changed files with 265 additions and 11 deletions

View File

@ -0,0 +1,33 @@
//
// HomebrewTest.swift
// PHP Monitor
//
// Created by Nico Verbruggen on 17/03/2023.
// Copyright © 2023 Nico Verbruggen. All rights reserved.
//
import XCTest
class HomebrewTest: XCTestCase {
static var outdatedFileUrl: URL {
return Bundle(for: Self.self)
.url(forResource: "brew-outdated", withExtension: "json")!
}
func test_upgradable_php_versions_can_be_parsed() async throws {
ActiveShell.useTestable([
"/opt/homebrew/bin/brew update >/dev/null && /opt/homebrew/bin/brew outdated --json --formulae": .instant(try! String(contentsOf: Self.outdatedFileUrl))
])
let env = PhpEnv.shared
env.cachedPhpInstallations = [
"8.1": PhpInstallation("8.1.3"),
"8.2": PhpInstallation("8.2.4"),
"7.4": PhpInstallation("7.4.11")
]
let brew = Brew.shared
let data = await brew.getPhpVersions()
print(data)
}
}