mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-12-22 11:30:07 +01:00
♻️ WIP: Change some tests to Swift Testing, add TestBundle
This commit is contained in:
@@ -6,21 +6,23 @@
|
||||
// Copyright © 2023 Nico Verbruggen. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import Testing
|
||||
|
||||
class CommandTest: XCTestCase {
|
||||
@Suite("Commands")
|
||||
struct CommandTest {
|
||||
|
||||
func test_determine_php_version() {
|
||||
@Test
|
||||
func determinePhpVersion() {
|
||||
let version = Command.execute(
|
||||
path: Paths.php,
|
||||
arguments: ["-v"],
|
||||
trimNewlines: false
|
||||
)
|
||||
|
||||
XCTAssert(version.contains("(cli)"))
|
||||
XCTAssert(version.contains("NTS"))
|
||||
XCTAssert(version.contains("built"))
|
||||
XCTAssert(version.contains("Zend"))
|
||||
#expect(version.contains("(cli)"))
|
||||
#expect(version.contains("NTS"))
|
||||
#expect(version.contains("built"))
|
||||
#expect(version.contains("Zend"))
|
||||
}
|
||||
|
||||
}
|
||||
19
tests/unit/_ST/Integration/PackagistTest.swift
Normal file
19
tests/unit/_ST/Integration/PackagistTest.swift
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// PackagistTest.swift
|
||||
// PHP Monitor
|
||||
//
|
||||
// Created by Nico Verbruggen on 25/08/2025.
|
||||
// Copyright © 2025 Nico Verbruggen. All rights reserved.
|
||||
//
|
||||
|
||||
import Testing
|
||||
|
||||
@Suite("Integration")
|
||||
struct PackagistTest {
|
||||
@Test func packagistRetrieval() async {
|
||||
let packageToCheck = "laravel/valet"
|
||||
let latestVersion = try? await Packagist.getLatestStableVersion(packageName: packageToCheck)
|
||||
|
||||
#expect(latestVersion != nil)
|
||||
}
|
||||
}
|
||||
@@ -6,18 +6,20 @@
|
||||
// Copyright © 2023 Nico Verbruggen. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
class ValetConfigurationTest: XCTestCase {
|
||||
import Testing
|
||||
import Foundation
|
||||
|
||||
@Suite("Parsers")
|
||||
struct ValetConfigurationTest {
|
||||
static var jsonConfigFileUrl: URL {
|
||||
return Bundle(for: Self.self).url(
|
||||
return TestBundle.url(
|
||||
forResource: "valet-config",
|
||||
withExtension: "json"
|
||||
)!
|
||||
}
|
||||
|
||||
func test_can_load_config_file() throws {
|
||||
@Test("Can load config file")
|
||||
func can_load_config_file() throws {
|
||||
let json = try? String(
|
||||
contentsOf: Self.jsonConfigFileUrl,
|
||||
encoding: .utf8
|
||||
@@ -27,13 +29,13 @@ class ValetConfigurationTest: XCTestCase {
|
||||
from: json!.data(using: .utf8)!
|
||||
)
|
||||
|
||||
XCTAssertEqual(config.tld, "test")
|
||||
XCTAssertEqual(config.paths, [
|
||||
#expect(config.tld == "test")
|
||||
#expect(config.paths == [
|
||||
"/Users/username/.config/valet/Sites",
|
||||
"/Users/username/Sites"
|
||||
])
|
||||
XCTAssertEqual(config.defaultSite, "/Users/username/default-site")
|
||||
XCTAssertEqual(config.loopback, "127.0.0.1")
|
||||
#expect(config.defaultSite == "/Users/username/default-site")
|
||||
#expect(config.loopback == "127.0.0.1")
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user