mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 03:50:08 +02:00
🚀 Version 7.0
This commit is contained in:
@ -181,9 +181,6 @@ class TestableConfigurations {
|
||||
"/opt/homebrew/bin/php -r echo ini_get('memory_limit');": "512M",
|
||||
"/opt/homebrew/bin/php -r echo ini_get('upload_max_filesize');": "512M",
|
||||
"/opt/homebrew/bin/php -r echo ini_get('post_max_size');": "512M",
|
||||
"/opt/homebrew/opt/php@8.2/bin/php -v": "OK (no full output needed for testing)",
|
||||
"/opt/homebrew/opt/php@8.1/bin/php -v": "OK (no full output needed for testing)",
|
||||
"/opt/homebrew/opt/php@8.0/bin/php -v": "OK (no full output needed for testing)"
|
||||
],
|
||||
preferenceOverrides: [
|
||||
.automaticBackgroundUpdateCheck: false
|
||||
@ -191,7 +188,8 @@ class TestableConfigurations {
|
||||
phpVersions: [
|
||||
VersionNumber(major: 8, minor: 2, patch: 6),
|
||||
VersionNumber(major: 8, minor: 1, patch: 0),
|
||||
VersionNumber(major: 8, minor: 0, patch: 0)
|
||||
VersionNumber(major: 8, minor: 0, patch: 0),
|
||||
VersionNumber(major: 7, minor: 4, patch: 33)
|
||||
]
|
||||
)
|
||||
}
|
||||
|
@ -54,6 +54,16 @@ final class MainMenuTest: UITestCase {
|
||||
app.mainMenuItem(withText: "mi_about".localized).click()
|
||||
}
|
||||
|
||||
final func test_can_open_config_editor() throws {
|
||||
let app = launch(openMenu: true)
|
||||
|
||||
app.buttons["phpConfigButton"].click()
|
||||
|
||||
Thread.sleep(forTimeInterval: 0.5)
|
||||
|
||||
assertExists(app.staticTexts["confman.title".localized], 1)
|
||||
}
|
||||
|
||||
final func test_can_open_settings() throws {
|
||||
let app = launch(openMenu: true)
|
||||
app.mainMenuItem(withText: "mi_preferences".localized).click()
|
||||
|
41
tests/unit/Parsers/ExtensionEnumeratorTest.swift
Normal file
41
tests/unit/Parsers/ExtensionEnumeratorTest.swift
Normal file
@ -0,0 +1,41 @@
|
||||
//
|
||||
// ExtensionEnumeratorTest.swift
|
||||
// Unit Tests
|
||||
//
|
||||
// Created by Nico Verbruggen on 30/10/2023.
|
||||
// Copyright © 2023 Nico Verbruggen. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
final class ExtensionEnumeratorTest: XCTestCase {
|
||||
|
||||
override func setUp() async throws {
|
||||
ActiveFileSystem.useTestable([
|
||||
"\(Paths.tapPath)/shivammathur/homebrew-extensions/Formula/xdebug@8.1.rb": .fake(.text, "<test>"),
|
||||
"\(Paths.tapPath)/shivammathur/homebrew-extensions/Formula/xdebug@8.2.rb": .fake(.text, "<test>"),
|
||||
"\(Paths.tapPath)/shivammathur/homebrew-extensions/Formula/xdebug@8.3.rb": .fake(.text, "<test>"),
|
||||
"\(Paths.tapPath)/shivammathur/homebrew-extensions/Formula/xdebug@8.4.rb": .fake(.text, "<test>"),
|
||||
])
|
||||
}
|
||||
|
||||
func testCanReadFormulae() throws {
|
||||
let directory = "\(Paths.tapPath)/shivammathur/homebrew-extensions/Formula"
|
||||
let files = try FileSystem.getShallowContentsOfDirectory(directory)
|
||||
|
||||
XCTAssertEqual(
|
||||
Set(["xdebug@8.1.rb", "xdebug@8.2.rb", "xdebug@8.3.rb", "xdebug@8.4.rb"]),
|
||||
Set(files)
|
||||
)
|
||||
}
|
||||
|
||||
func testCanParseFormulaeBasedOnSyntax() throws {
|
||||
let formulae = BrewTapFormulae.from(tap: "shivammathur/homebrew-extensions")
|
||||
|
||||
XCTAssertEqual(formulae["8.1"], [BrewPhpExtension(path: "/", name: "xdebug", phpVersion: "8.1")])
|
||||
XCTAssertEqual(formulae["8.2"], [BrewPhpExtension(path: "/", name: "xdebug", phpVersion: "8.2")])
|
||||
XCTAssertEqual(formulae["8.3"], [BrewPhpExtension(path: "/", name: "xdebug", phpVersion: "8.3")])
|
||||
XCTAssertEqual(formulae["8.4"], [BrewPhpExtension(path: "/", name: "xdebug", phpVersion: "8.4")])
|
||||
}
|
||||
|
||||
}
|
@ -17,7 +17,15 @@ class HomebrewUpgradableTest: XCTestCase {
|
||||
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))
|
||||
: .instant(try! String(contentsOf: Self.outdatedFileUrl)),
|
||||
"/opt/homebrew/bin/php --ini | grep -E -o '(/[^ ]+\\.ini)'"
|
||||
: .instant("/opt/homebrew/etc/php/8.2/conf.d/php-memory-limits.ini"),
|
||||
"/opt/homebrew/opt/php@8.1.16/bin/php --ini | grep -E -o '(/[^ ]+\\.ini)'"
|
||||
: .instant("/opt/homebrew/etc/php/8.1/conf.d/php-memory-limits.ini"),
|
||||
"/opt/homebrew/opt/php@8.2.3/bin/php --ini | grep -E -o '(/[^ ]+\\.ini)'"
|
||||
: .instant("/opt/homebrew/etc/php/8.2/conf.d/php-memory-limits.ini"),
|
||||
"/opt/homebrew/opt/php@7.4.11/bin/php --ini | grep -E -o '(/[^ ]+\\.ini)'"
|
||||
: .instant("/opt/homebrew/etc/php/7.4/conf.d/php-memory-limits.ini")
|
||||
])
|
||||
|
||||
let env = PhpEnvironments.shared
|
||||
@ -27,7 +35,7 @@ class HomebrewUpgradableTest: XCTestCase {
|
||||
"7.4": PhpInstallation("7.4.11")
|
||||
]
|
||||
|
||||
let data = await BrewFormulaeHandler().loadPhpVersions(loadOutdated: true)
|
||||
let data = await BrewPhpFormulaeHandler().loadPhpVersions(loadOutdated: true)
|
||||
|
||||
XCTAssertTrue(data.contains(where: { formula in
|
||||
formula.installedVersion == "8.1.16" && formula.upgradeVersion == "8.1.17"
|
||||
|
@ -23,6 +23,14 @@ class RealShellTest: XCTestCase {
|
||||
XCTAssertTrue(output.out.contains("Copyright (c) The PHP Group"))
|
||||
}
|
||||
|
||||
func test_system_shell_can_be_used_synchronously() {
|
||||
XCTAssertTrue(Shell is RealShell)
|
||||
|
||||
let output = Shell.sync("php -v")
|
||||
|
||||
XCTAssertTrue(output.out.contains("Copyright (c) The PHP Group"))
|
||||
}
|
||||
|
||||
func test_system_shell_has_path() {
|
||||
let systemShell = Shell as! RealShell
|
||||
|
||||
|
@ -30,6 +30,35 @@ class TestableShellTest: XCTestCase {
|
||||
|
||||
XCTAssertEqual("Hello world\nGoodbye world", output.out)
|
||||
}
|
||||
|
||||
func test_fake_shell_synchronous_output() {
|
||||
let greeting = BatchFakeShellOutput(items: [
|
||||
.instant("Hello world\n"),
|
||||
.delayed(0.2, "Goodbye world")
|
||||
])
|
||||
|
||||
let output = greeting.syncOutput()
|
||||
|
||||
XCTAssertEqual("Hello world\nGoodbye world", output.out)
|
||||
}
|
||||
|
||||
func test_fake_shell_usage() {
|
||||
let expectedOutput = """
|
||||
PHP 8.3.0 (cli) (built: Nov 21 2023 14:40:35) (NTS)
|
||||
Copyright (c) The PHP Group
|
||||
Zend Engine v4.3.0, Copyright (c) Zend Technologies
|
||||
with Xdebug v3.2.2, Copyright (c) 2002-2023, by Derick Rethans
|
||||
with Zend OPcache v8.3.0, Copyright (c), by Zend Technologies
|
||||
"""
|
||||
|
||||
let shell = TestableShell(expectations: [
|
||||
"php -v": .instant(expectedOutput),
|
||||
"echo $PATH": .instant("/Users/user/bin:/opt/homebrew/bin")
|
||||
])
|
||||
|
||||
XCTAssertEqual(expectedOutput, shell.sync("php -v").out)
|
||||
XCTAssertEqual("/Users/user/bin:/opt/homebrew/bin", shell.sync("echo $PATH").out)
|
||||
}
|
||||
|
||||
func test_fake_shell_has_path() {
|
||||
ActiveShell.useTestable([:])
|
||||
|
Reference in New Issue
Block a user