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"
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
disableMainThreadChecker = "YES">
|
||||||
<Testables>
|
<Testables>
|
||||||
<TestableReference
|
<TestableReference
|
||||||
skipped = "NO">
|
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>
|
<dict>
|
||||||
<key>ContainerMacro.xcscheme_^#shared#^_</key>
|
<key>ContainerMacro.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>isShown</key>
|
||||||
|
<false/>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>4</integer>
|
<integer>4</integer>
|
||||||
</dict>
|
</dict>
|
||||||
@@ -15,5 +17,13 @@
|
|||||||
<integer>4</integer>
|
<integer>4</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
|
<key>SuppressBuildableAutocreation</key>
|
||||||
|
<dict>
|
||||||
|
<key>ContainerMacro</key>
|
||||||
|
<dict>
|
||||||
|
<key>primary</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
extension InternalSwitcher {
|
extension InternalSwitcher {
|
||||||
|
|
||||||
typealias FixApplied = Bool
|
typealias FixApplied = Bool
|
||||||
|
|
||||||
public func ensureValetConfigurationIsValidForPhpVersion(_ version: String) async -> FixApplied {
|
public func ensureValetConfigurationIsValidForPhpVersion(_ version: String) async -> FixApplied {
|
||||||
@@ -30,19 +29,19 @@ extension InternalSwitcher {
|
|||||||
// MARK: - Corrections
|
// MARK: - Corrections
|
||||||
|
|
||||||
public func disableDefaultPhpFpmPool(_ version: String) async -> FixApplied {
|
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).")
|
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 existing = "\(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 new = "\(container.paths.etcPath)/php/\(version)/php-fpm.d/www.conf.disabled-by-phpmon"
|
||||||
do {
|
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), "
|
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.")
|
+ "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).")
|
Log.info("Success: A default `www.conf` file was disabled for PHP \(version).")
|
||||||
return true
|
return true
|
||||||
} catch {
|
} catch {
|
||||||
@@ -59,7 +58,7 @@ extension InternalSwitcher {
|
|||||||
|
|
||||||
// For each of the files, attempt to fix anything that is wrong
|
// For each of the files, attempt to fix anything that is wrong
|
||||||
let outcomes = files.map { file in
|
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 {
|
if configFileExists {
|
||||||
return false
|
return false
|
||||||
@@ -72,14 +71,14 @@ extension InternalSwitcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
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 {
|
for (original, replacement) in file.replacements {
|
||||||
contents = contents.replacingOccurrences(of: original, with: replacement)
|
contents = contents.replacingOccurrences(of: original, with: replacement)
|
||||||
}
|
}
|
||||||
|
|
||||||
try App.shared.container.filesystem.writeAtomicallyToFile(
|
try container.filesystem.writeAtomicallyToFile(
|
||||||
"\(App.shared.container.paths.etcPath)/php/\(version)" + file.destination,
|
"\(container.paths.etcPath)/php/\(version)" + file.destination,
|
||||||
content: contents
|
content: contents
|
||||||
)
|
)
|
||||||
} catch {
|
} catch {
|
||||||
@@ -102,7 +101,7 @@ extension InternalSwitcher {
|
|||||||
destination: "/php-fpm.d/valet-fpm.conf",
|
destination: "/php-fpm.d/valet-fpm.conf",
|
||||||
source: "/cli/stubs/etc-phpfpm-valet.conf",
|
source: "/cli/stubs/etc-phpfpm-valet.conf",
|
||||||
replacements: [
|
replacements: [
|
||||||
"VALET_USER": App.shared.container.paths.whoami,
|
"VALET_USER": container.paths.whoami,
|
||||||
"VALET_HOME_PATH": "~/.config/valet".replacingTildeWithHomeDirectory,
|
"VALET_HOME_PATH": "~/.config/valet".replacingTildeWithHomeDirectory,
|
||||||
"valet.sock": "valet\(version.replacingOccurrences(of: ".", with: "")).sock"
|
"valet.sock": "valet\(version.replacingOccurrences(of: ".", with: "")).sock"
|
||||||
],
|
],
|
||||||
@@ -112,7 +111,7 @@ extension InternalSwitcher {
|
|||||||
destination: "/conf.d/error_log.ini",
|
destination: "/conf.d/error_log.ini",
|
||||||
source: "/cli/stubs/etc-phpfpm-error_log.ini",
|
source: "/cli/stubs/etc-phpfpm-error_log.ini",
|
||||||
replacements: [
|
replacements: [
|
||||||
"VALET_USER": App.shared.container.paths.whoami,
|
"VALET_USER": container.paths.whoami,
|
||||||
"VALET_HOME_PATH": "~/.config/valet".replacingTildeWithHomeDirectory
|
"VALET_HOME_PATH": "~/.config/valet".replacingTildeWithHomeDirectory
|
||||||
],
|
],
|
||||||
applies: { return true }
|
applies: { return true }
|
||||||
|
|||||||
@@ -104,7 +104,6 @@ extension StatusMenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@MainActor func addPreferencesMenuItems() {
|
@MainActor func addPreferencesMenuItems() {
|
||||||
|
|
||||||
addItems([
|
addItems([
|
||||||
NSMenuItem.separator(),
|
NSMenuItem.separator(),
|
||||||
NSMenuItem(title: "mi_preferences".localized,
|
NSMenuItem(title: "mi_preferences".localized,
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
},
|
},
|
||||||
"testTargets" : [
|
"testTargets" : [
|
||||||
{
|
{
|
||||||
"enabled" : false,
|
|
||||||
"parallelizable" : false,
|
"parallelizable" : false,
|
||||||
"target" : {
|
"target" : {
|
||||||
"containerPath" : "container:PHP Monitor.xcodeproj",
|
"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)
|
"/opt/homebrew/etc/php/8.1/php-fpm.d/www.conf": .fake(.text)
|
||||||
]), fs = c.filesystem as! TestableFileSystem
|
]), 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)
|
XCTAssertTrue(outcome)
|
||||||
|
|
||||||
assertFileSystemHas("/opt/homebrew/etc/php/8.1/php-fpm.d/www.conf.disabled-by-phpmon", in: fs)
|
assertFileSystemHas("/opt/homebrew/etc/php/8.1/php-fpm.d/www.conf.disabled-by-phpmon", in: fs)
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
final class MainMenuTest: UITestCase {
|
final class MainMenuTest: UITestCase {
|
||||||
|
|
||||||
override func setUpWithError() throws {
|
override func setUpWithError() throws {
|
||||||
continueAfterFailure = false
|
continueAfterFailure = false
|
||||||
}
|
}
|
||||||
@@ -30,7 +29,8 @@ final class MainMenuTest: UITestCase {
|
|||||||
app.menuItems["mi_quit".localized]
|
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 {
|
final func test_can_open_domains_list() throws {
|
||||||
@@ -40,13 +40,13 @@ final class MainMenuTest: UITestCase {
|
|||||||
|
|
||||||
final func test_can_open_php_doctor() throws {
|
final func test_can_open_php_doctor() throws {
|
||||||
let app = launch(openMenu: true)
|
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()
|
app.mainMenuItem(withText: "mi_fa_php_doctor".localized).click()
|
||||||
}
|
}
|
||||||
|
|
||||||
final func test_can_view_onboarding_flow() throws {
|
final func test_can_view_onboarding_flow() throws {
|
||||||
let app = launch(openMenu: true)
|
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()
|
app.mainMenuItem(withText: "mi_view_onboarding".localized).click()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user