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

Add updater to project

If you want to see the source code to the updater, you can find it here:
https://github.com/nicoverbruggen/phpmon-updater

Starting with version 6.0, the code of the updater will be included
in this repository.
This commit is contained in:
2023-02-05 18:37:18 +01:00
parent 5ac4817048
commit 2c40f433d3
17 changed files with 466 additions and 272 deletions

View File

@ -1,47 +0,0 @@
//
// AppUpdaterCheckTest.swift
// PHP Monitor
//
// Created by Nico Verbruggen on 10/05/2022.
// Copyright © 2023 Nico Verbruggen. All rights reserved.
//
import XCTest
class AppUpdaterCheckTest: XCTestCase {
func test_can_retrieve_version_from_cask() async {
let caskVersion = await AppUpdateChecker.retrieveVersionFromCask()
let version = VersionExtractor.from(caskVersion)
XCTAssertNotNil(version)
}
func test_tagged_release_omits_zero_patch() {
let version = AppVersion.from("3.5.0_333")!
XCTAssertEqual(version.tagged, "3.5")
XCTAssertEqual(version.version, "3.5.0")
}
func test_tagged_release_doesnt_omit_non_zero_patch() {
let version = AppVersion.from("3.5.1_333")!
XCTAssertEqual(version.tagged, "3.5.1")
XCTAssertEqual(version.version, "3.5.1")
}
func test_tag_truncation_does_not_affect_major_versions() {
var version = AppVersion.from("5.0_333")!
XCTAssertEqual(version.tagged, "5.0")
XCTAssertEqual(version.version, "5.0")
version = AppVersion.from("5.0.0_333")!
XCTAssertEqual(version.tagged, "5.0")
XCTAssertEqual(version.version, "5.0.0")
}
}

View File

@ -28,7 +28,7 @@ class AppVersionTest: XCTestCase {
XCTAssertNotNil(version)
XCTAssertEqual("1.0.0", version?.version)
XCTAssertEqual("600", version?.build)
XCTAssertEqual(600, version?.build)
XCTAssertEqual(nil, version?.suffix)
}
@ -46,7 +46,7 @@ class AppVersionTest: XCTestCase {
XCTAssertNotNil(version)
XCTAssertEqual("1.0.0", version?.version)
XCTAssertEqual("870", version?.build)
XCTAssertEqual(870, version?.build)
XCTAssertEqual("dev", version?.suffix)
}
@ -55,8 +55,48 @@ class AppVersionTest: XCTestCase {
XCTAssertNotNil(version)
XCTAssertEqual("1.0.0", version?.version)
XCTAssertEqual("870", version?.build)
XCTAssertEqual(870, version?.build)
XCTAssertEqual("dev", version?.suffix)
}
func test_tagged_release_omits_zero_patch() {
let version = AppVersion.from("3.5.0_333")!
XCTAssertEqual(version.tagged, "3.5")
XCTAssertEqual(version.version, "3.5.0")
}
func test_tagged_release_doesnt_omit_non_zero_patch() {
let version = AppVersion.from("3.5.1_333")!
XCTAssertEqual(version.tagged, "3.5.1")
XCTAssertEqual(version.version, "3.5.1")
}
func test_tag_truncation_does_not_affect_major_versions() {
var version = AppVersion.from("5.0_333")!
XCTAssertEqual(version.tagged, "5.0")
XCTAssertEqual(version.version, "5.0")
version = AppVersion.from("5.0.0_333")!
XCTAssertEqual(version.tagged, "5.0")
XCTAssertEqual(version.version, "5.0.0")
}
func test_can_compare_version_numbers() {
// Build is newer
XCTAssertTrue(AppVersion.from("5.0_101")! > AppVersion.from("5.0_100")!)
// Version and build is the same
XCTAssertFalse(AppVersion.from("5.0.0_100")! > AppVersion.from("5.0_100")!)
// Version is newer
XCTAssertTrue(AppVersion.from("5.1_100")! > AppVersion.from("5.0_100")!)
// Build is older
XCTAssertFalse(AppVersion.from("5.0_101")! > AppVersion.from("5.0_102")!)
}
}