1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-07 03:50: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

@ -10,21 +10,13 @@ import XCTest
final class InternalSwitcherTest: FeatureTestCase {
public func testDefaultPhpFpmPoolRequiresDisabling() async {
ActiveFileSystem.useTestable([
"/opt/homebrew/etc/php/8.1/php-fpm.d/www.conf": .fake(.text)
])
assertFileSystemHas("/opt/homebrew/etc/php/8.1/php-fpm.d/www.conf")
XCTAssertTrue(InternalSwitcher().requiresDisablingOfDefaultPhpFpmPool("8.1"))
}
public func testDefaultPhpFpmPoolIsMoved() async {
ActiveFileSystem.useTestable([
"/opt/homebrew/etc/php/8.1/php-fpm.d/www.conf": .fake(.text)
])
await InternalSwitcher().disableDefaultPhpFpmPool("8.1")
let outcome = await InternalSwitcher().disableDefaultPhpFpmPool("8.1")
XCTAssertTrue(outcome)
assertFileSystemHas("/opt/homebrew/etc/php/8.1/php-fpm.d/www.conf.disabled-by-phpmon")
assertFileSystemDoesNotHave("/opt/homebrew/etc/php/8.1/php-fpm.d/www.conf")
@ -41,7 +33,8 @@ final class InternalSwitcherTest: FeatureTestCase {
contents: "phpmon generated"
)
await InternalSwitcher().disableDefaultPhpFpmPool("8.1")
let outcome = await InternalSwitcher().disableDefaultPhpFpmPool("8.1")
XCTAssertTrue(outcome)
assertFileSystemHas("/opt/homebrew/etc/php/8.1/php-fpm.d/www.conf.disabled-by-phpmon")
assertFileSystemDoesNotHave("/opt/homebrew/etc/php/8.1/php-fpm.d/www.conf")

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)
}
}

View File

@ -0,0 +1,169 @@
{
"formulae": [
{
"name": "cmake",
"installed_versions": [
"3.25.2"
],
"current_version": "3.26.0",
"pinned": false,
"pinned_version": null
},
{
"name": "cmocka",
"installed_versions": [
"1.1.5"
],
"current_version": "1.1.7",
"pinned": false,
"pinned_version": null
},
{
"name": "glib",
"installed_versions": [
"2.74.6"
],
"current_version": "2.76.0",
"pinned": false,
"pinned_version": null
},
{
"name": "harfbuzz",
"installed_versions": [
"7.0.1"
],
"current_version": "7.1.0",
"pinned": false,
"pinned_version": null
},
{
"name": "httpd",
"installed_versions": [
"2.4.55"
],
"current_version": "2.4.56",
"pinned": false,
"pinned_version": null
},
{
"name": "imagemagick",
"installed_versions": [
"7.1.1-2"
],
"current_version": "7.1.1-3",
"pinned": false,
"pinned_version": null
},
{
"name": "libarchive",
"installed_versions": [
"3.6.2"
],
"current_version": "3.6.2_1",
"pinned": false,
"pinned_version": null
},
{
"name": "libsndfile",
"installed_versions": [
"1.2.0"
],
"current_version": "1.2.0_1",
"pinned": false,
"pinned_version": null
},
{
"name": "libvidstab",
"installed_versions": [
"1.1.0"
],
"current_version": "1.1.1",
"pinned": false,
"pinned_version": null
},
{
"name": "libvpx",
"installed_versions": [
"1.12.0"
],
"current_version": "1.13.0",
"pinned": false,
"pinned_version": null
},
{
"name": "node",
"installed_versions": [
"19.6.0"
],
"current_version": "19.8.1",
"pinned": false,
"pinned_version": null
},
{
"name": "pango",
"installed_versions": [
"1.50.13"
],
"current_version": "1.50.14",
"pinned": false,
"pinned_version": null
},
{
"name": "php",
"installed_versions": [
"8.2.3"
],
"current_version": "8.2.4",
"pinned": false,
"pinned_version": null
},
{
"name": "php@8.1",
"installed_versions": [
"8.1.16"
],
"current_version": "8.1.17",
"pinned": false,
"pinned_version": null
},
{
"name": "rclone",
"installed_versions": [
"1.61.1"
],
"current_version": "1.62.2",
"pinned": false,
"pinned_version": null
},
{
"name": "sdl2",
"installed_versions": [
"2.26.3"
],
"current_version": "2.26.4",
"pinned": false,
"pinned_version": null
},
{
"name": "snappy",
"installed_versions": [
"1.1.9"
],
"current_version": "1.1.10",
"pinned": false,
"pinned_version": null
},
{
"name": "tcl-tk",
"installed_versions": [
"8.6.13"
],
"current_version": "8.6.13_1",
"pinned": false,
"pinned_version": null
}
],
"casks": [
]
}