1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-11-05 12:30:07 +01:00

♻️ Prevent unit tests from running concurrently

The way the testing classes are built with the singletons currently
prevents various test structs from being run at the same time.

I've adjusted the tests in the PHP Monitor EAP test configuration so
that they are not executed concurrently. This does slow down the test
suite but prevents odd crashes from individual tests interfering with
other tests.

It's not an ideal solution and I would like to address this in the
future, but I suspect this will be rather cumbersome. Since the app
does not actually suffer from this particular issue, this is something
worth investigating later.
This commit is contained in:
2025-09-30 16:14:17 +02:00
parent f366be865b
commit 85b12d1aec
9 changed files with 36 additions and 81 deletions

View File

@@ -1,67 +0,0 @@
{
"configurations" : [
{
"id" : "98F42C11-E6D2-4AD9-A5CA-40EFE44F384A",
"name" : "Configuration 1",
"options" : {
}
}
],
"defaultOptions" : {
"codeCoverage" : false,
"commandLineArgumentEntries" : [
{
"argument" : "--v",
"enabled" : false
}
],
"environmentVariableEntries" : [
{
"enabled" : false,
"key" : "EXTREME_DOCTOR_MODE",
"value" : ""
},
{
"enabled" : false,
"key" : "SLOW_SHELL_MODE",
"value" : ""
},
{
"enabled" : false,
"key" : "PAINT_PHPMON_SWIFTUI_VIEWS",
"value" : ""
}
],
"targetForVariableExpansion" : {
"containerPath" : "container:PHP Monitor.xcodeproj",
"identifier" : "C41C1B3222B0097F00E7CF16",
"name" : "PHP Monitor"
}
},
"testTargets" : [
{
"parallelizable" : true,
"target" : {
"containerPath" : "container:PHP Monitor.xcodeproj",
"identifier" : "C4F7807825D7F84B000DBC97",
"name" : "Unit Tests"
}
},
{
"target" : {
"containerPath" : "container:PHP Monitor.xcodeproj",
"identifier" : "C471E7AC28F9B4940021E251",
"name" : "Feature Tests"
}
},
{
"target" : {
"containerPath" : "container:PHP Monitor.xcodeproj",
"identifier" : "C471E7BB28F9B90F0021E251",
"name" : "UI Tests"
}
}
],
"version" : 1
}

View File

@@ -153,6 +153,21 @@ class TestableConfigurations {
app 'PHP Monitor DEV.app', target: "PHP Monitor DEV.app"
end
"""),
"curl -s --max-time 10 'https://raw.githubusercontent.com/nicoverbruggen/homebrew-cask/master/Casks/phpmon.rb''" :
.delayed(0.5, """
cask 'phpmon-dev' do
depends_on formula: 'gnu-sed'
version '25.08.0_1000'
sha256 '1cb147bd1b1fbd52971d90dff577465b644aee7c878f15ede57f46e8f217067a'
url 'https://github.com/nicoverbruggen/phpmon/releases/download/v6.0/phpmon-dev.zip'
name 'PHP Monitor DEV'
homepage 'https://phpmon.app'
app 'PHP Monitor DEV.app', target: "PHP Monitor DEV.app"
end
"""),
"/opt/homebrew/bin/brew unlink php"
: .delayed(0.2, "OK"),
"/opt/homebrew/bin/brew unlink php@8.2"

View File

@@ -9,8 +9,13 @@
import Testing
import Foundation
@Suite(.serialized)
struct CaskFileParserTest {
init() async throws {
ActiveShell.useSystem()
}
// MARK: - Test Files
static var exampleFilePath: URL {
TestBundle.url(forResource: "phpmon-dev", withExtension: "rb")!

View File

@@ -9,13 +9,14 @@
import Testing
import Foundation
@Suite(.serialized)
class PhpConfigurationFileTest {
static var phpIniFileUrl: URL {
return TestBundle.url(forResource: "php", withExtension: "ini")!
}
@Test func can_load_extension() throws {
ActiveFileSystem.useSystem()
let iniFile = PhpConfigurationFile.from(filePath: Self.phpIniFileUrl.path)
#expect(iniFile != nil)
@@ -23,6 +24,7 @@ class PhpConfigurationFileTest {
}
@Test func can_check_key_existence() throws {
print(Self.phpIniFileUrl.path)
let iniFile = PhpConfigurationFile.from(filePath: Self.phpIniFileUrl.path)!
#expect(iniFile.has(key: "error_reporting"))

View File

@@ -9,7 +9,12 @@
import Testing
import Foundation
@Suite(.serialized)
struct PhpExtensionTest {
init () async throws {
ActiveShell.useSystem()
}
static var phpIniFileUrl: URL {
TestBundle.url(forResource: "php", withExtension: "ini")!
}