mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-12-21 03:10:06 +01:00
✅ All tests pass again
This commit is contained in:
@@ -10,7 +10,8 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
disableMainThreadChecker = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "2600"
|
||||
version = "1.7">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES"
|
||||
buildArchitectures = "Automatic">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "ContainerMacro"
|
||||
BuildableName = "ContainerMacro"
|
||||
BlueprintName = "ContainerMacro"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
shouldAutocreateTestPlan = "YES">
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "ContainerMacro"
|
||||
BuildableName = "ContainerMacro"
|
||||
BlueprintName = "ContainerMacro"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -6,6 +6,8 @@
|
||||
<dict>
|
||||
<key>ContainerMacro.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>4</integer>
|
||||
</dict>
|
||||
@@ -15,5 +17,13 @@
|
||||
<integer>4</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
<dict>
|
||||
<key>ContainerMacro</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -104,7 +104,6 @@ extension StatusMenu {
|
||||
}
|
||||
|
||||
@MainActor func addPreferencesMenuItems() {
|
||||
|
||||
addItems([
|
||||
NSMenuItem.separator(),
|
||||
NSMenuItem(title: "mi_preferences".localized,
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
},
|
||||
"testTargets" : [
|
||||
{
|
||||
"enabled" : false,
|
||||
"parallelizable" : false,
|
||||
"target" : {
|
||||
"containerPath" : "container:PHP Monitor.xcodeproj",
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user