From a0e2907fae6189d74b7965ea95310d3f1be7c796 Mon Sep 17 00:00:00 2001 From: Nico Verbruggen Date: Thu, 16 Oct 2025 14:43:29 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20All=20tests=20pass=20again?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xcschemes/Unit Tests.xcscheme | 3 +- .../xcschemes/ContainerMacro.xcscheme | 67 +++++++++++++++++++ .../xcschemes/xcschememanagement.plist | 10 +++ .../PHP/Switcher/InternalSwitcher+Valet.swift | 27 ++++---- phpmon/Domain/Menu/StatusMenu+Items.swift | 1 - tests/PHP Monitor.xctestplan | 1 - tests/feature/InternalSwitcherTest.swift | 4 +- tests/ui/MainMenuTest.swift | 8 +-- 8 files changed, 99 insertions(+), 22 deletions(-) create mode 100644 packages/container-macro/.swiftpm/xcode/xcshareddata/xcschemes/ContainerMacro.xcscheme diff --git a/PHP Monitor.xcodeproj/xcshareddata/xcschemes/Unit Tests.xcscheme b/PHP Monitor.xcodeproj/xcshareddata/xcschemes/Unit Tests.xcscheme index f8a9767f..bf4750e6 100644 --- a/PHP Monitor.xcodeproj/xcshareddata/xcschemes/Unit Tests.xcscheme +++ b/PHP Monitor.xcodeproj/xcshareddata/xcschemes/Unit Tests.xcscheme @@ -10,7 +10,8 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> + shouldUseLaunchSchemeArgsEnv = "YES" + disableMainThreadChecker = "YES"> diff --git a/packages/container-macro/.swiftpm/xcode/xcshareddata/xcschemes/ContainerMacro.xcscheme b/packages/container-macro/.swiftpm/xcode/xcshareddata/xcschemes/ContainerMacro.xcscheme new file mode 100644 index 00000000..26ea87eb --- /dev/null +++ b/packages/container-macro/.swiftpm/xcode/xcshareddata/xcschemes/ContainerMacro.xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/container-macro/.swiftpm/xcode/xcuserdata/nico.xcuserdatad/xcschemes/xcschememanagement.plist b/packages/container-macro/.swiftpm/xcode/xcuserdata/nico.xcuserdatad/xcschemes/xcschememanagement.plist index 537602e9..162c6676 100644 --- a/packages/container-macro/.swiftpm/xcode/xcuserdata/nico.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/packages/container-macro/.swiftpm/xcode/xcuserdata/nico.xcuserdatad/xcschemes/xcschememanagement.plist @@ -6,6 +6,8 @@ ContainerMacro.xcscheme_^#shared#^_ + isShown + orderHint 4 @@ -15,5 +17,13 @@ 4 + SuppressBuildableAutocreation + + ContainerMacro + + primary + + + diff --git a/phpmon/Common/PHP/Switcher/InternalSwitcher+Valet.swift b/phpmon/Common/PHP/Switcher/InternalSwitcher+Valet.swift index 815b5d2f..b3c021c7 100644 --- a/phpmon/Common/PHP/Switcher/InternalSwitcher+Valet.swift +++ b/phpmon/Common/PHP/Switcher/InternalSwitcher+Valet.swift @@ -9,7 +9,6 @@ import Foundation extension InternalSwitcher { - typealias FixApplied = Bool public func ensureValetConfigurationIsValidForPhpVersion(_ version: String) async -> FixApplied { @@ -30,19 +29,19 @@ extension InternalSwitcher { // MARK: - Corrections public func disableDefaultPhpFpmPool(_ version: String) async -> FixApplied { - let pool = "\(App.shared.container.paths.etcPath)/php/\(version)/php-fpm.d/www.conf" + let pool = "\(container.paths.etcPath)/php/\(version)/php-fpm.d/www.conf" - if App.shared.container.filesystem.fileExists(pool) { + if container.filesystem.fileExists(pool) { Log.info("A default `www.conf` file was found in the php-fpm.d directory for PHP \(version).") - let existing = "\(App.shared.container.paths.etcPath)/php/\(version)/php-fpm.d/www.conf" - let new = "\(App.shared.container.paths.etcPath)/php/\(version)/php-fpm.d/www.conf.disabled-by-phpmon" + let existing = "\(container.paths.etcPath)/php/\(version)/php-fpm.d/www.conf" + let new = "\(container.paths.etcPath)/php/\(version)/php-fpm.d/www.conf.disabled-by-phpmon" do { - if App.shared.container.filesystem.fileExists(new) { + if container.filesystem.fileExists(new) { Log.info("A moved `www.conf.disabled-by-phpmon` file was found for PHP \(version), " + "cleaning up so the newer `www.conf` can be moved again.") - try App.shared.container.filesystem.remove(new) + try container.filesystem.remove(new) } - try App.shared.container.filesystem.move(from: existing, to: new) + try container.filesystem.move(from: existing, to: new) Log.info("Success: A default `www.conf` file was disabled for PHP \(version).") return true } catch { @@ -59,7 +58,7 @@ extension InternalSwitcher { // For each of the files, attempt to fix anything that is wrong let outcomes = files.map { file in - let configFileExists = App.shared.container.filesystem.fileExists("\(App.shared.container.paths.etcPath)/php/\(version)/" + file.destination) + let configFileExists = container.filesystem.fileExists("\(container.paths.etcPath)/php/\(version)/" + file.destination) if configFileExists { return false @@ -72,14 +71,14 @@ extension InternalSwitcher { } do { - var contents = try App.shared.container.filesystem.getStringFromFile("~/.composer/vendor/laravel/valet" + file.source) + var contents = try container.filesystem.getStringFromFile("~/.composer/vendor/laravel/valet" + file.source) for (original, replacement) in file.replacements { contents = contents.replacingOccurrences(of: original, with: replacement) } - try App.shared.container.filesystem.writeAtomicallyToFile( - "\(App.shared.container.paths.etcPath)/php/\(version)" + file.destination, + try container.filesystem.writeAtomicallyToFile( + "\(container.paths.etcPath)/php/\(version)" + file.destination, content: contents ) } catch { @@ -102,7 +101,7 @@ extension InternalSwitcher { destination: "/php-fpm.d/valet-fpm.conf", source: "/cli/stubs/etc-phpfpm-valet.conf", replacements: [ - "VALET_USER": App.shared.container.paths.whoami, + "VALET_USER": container.paths.whoami, "VALET_HOME_PATH": "~/.config/valet".replacingTildeWithHomeDirectory, "valet.sock": "valet\(version.replacingOccurrences(of: ".", with: "")).sock" ], @@ -112,7 +111,7 @@ extension InternalSwitcher { destination: "/conf.d/error_log.ini", source: "/cli/stubs/etc-phpfpm-error_log.ini", replacements: [ - "VALET_USER": App.shared.container.paths.whoami, + "VALET_USER": container.paths.whoami, "VALET_HOME_PATH": "~/.config/valet".replacingTildeWithHomeDirectory ], applies: { return true } diff --git a/phpmon/Domain/Menu/StatusMenu+Items.swift b/phpmon/Domain/Menu/StatusMenu+Items.swift index 7992cc2e..0b222838 100644 --- a/phpmon/Domain/Menu/StatusMenu+Items.swift +++ b/phpmon/Domain/Menu/StatusMenu+Items.swift @@ -104,7 +104,6 @@ extension StatusMenu { } @MainActor func addPreferencesMenuItems() { - addItems([ NSMenuItem.separator(), NSMenuItem(title: "mi_preferences".localized, diff --git a/tests/PHP Monitor.xctestplan b/tests/PHP Monitor.xctestplan index c0d2798c..81846323 100644 --- a/tests/PHP Monitor.xctestplan +++ b/tests/PHP Monitor.xctestplan @@ -13,7 +13,6 @@ }, "testTargets" : [ { - "enabled" : false, "parallelizable" : false, "target" : { "containerPath" : "container:PHP Monitor.xcodeproj", diff --git a/tests/feature/InternalSwitcherTest.swift b/tests/feature/InternalSwitcherTest.swift index 3631fdf0..942f8960 100644 --- a/tests/feature/InternalSwitcherTest.swift +++ b/tests/feature/InternalSwitcherTest.swift @@ -14,7 +14,9 @@ final class InternalSwitcherTest: FeatureTestCase { "/opt/homebrew/etc/php/8.1/php-fpm.d/www.conf": .fake(.text) ]), fs = c.filesystem as! TestableFileSystem - let outcome = await InternalSwitcher(container: c).disableDefaultPhpFpmPool("8.1") + let outcome = await InternalSwitcher(container: c) + .disableDefaultPhpFpmPool("8.1") + XCTAssertTrue(outcome) assertFileSystemHas("/opt/homebrew/etc/php/8.1/php-fpm.d/www.conf.disabled-by-phpmon", in: fs) diff --git a/tests/ui/MainMenuTest.swift b/tests/ui/MainMenuTest.swift index 4d205ff2..93db5579 100644 --- a/tests/ui/MainMenuTest.swift +++ b/tests/ui/MainMenuTest.swift @@ -9,7 +9,6 @@ import XCTest final class MainMenuTest: UITestCase { - override func setUpWithError() throws { continueAfterFailure = false } @@ -30,7 +29,8 @@ final class MainMenuTest: UITestCase { app.menuItems["mi_quit".localized] ]) - sleep(2) + // Wait briefly + _ = app.menuItems["mi_about".localized].waitForExistence(timeout: 2.0) } final func test_can_open_domains_list() throws { @@ -40,13 +40,13 @@ final class MainMenuTest: UITestCase { final func test_can_open_php_doctor() throws { let app = launch(openMenu: true) - app.mainMenuItem(withText: "mi_other".localized).click() + app.mainMenuItem(withText: "mi_other".localized).hover() app.mainMenuItem(withText: "mi_fa_php_doctor".localized).click() } final func test_can_view_onboarding_flow() throws { let app = launch(openMenu: true) - app.mainMenuItem(withText: "mi_other".localized).click() + app.mainMenuItem(withText: "mi_other".localized).hover() app.mainMenuItem(withText: "mi_view_onboarding".localized).click() }