1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-06 11:30:08 +02:00

🚛 Moved tests around, added Feature, UI tests

This commit is contained in:
2022-10-14 18:03:14 +02:00
parent d91e16d674
commit eaf6ef658f
36 changed files with 1028 additions and 59 deletions

File diff suppressed because it is too large Load Diff

View File

@ -29,12 +29,24 @@
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C4F7807825D7F84B000DBC97"
BuildableName = "phpmon-tests.xctest"
BlueprintName = "phpmon-tests"
BuildableName = "Unit Tests.xctest"
BlueprintName = "Unit Tests"
ReferencedContainer = "container:PHP Monitor.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C471E7BB28F9B90F0021E251"
BuildableName = "UI Tests.xctest"
BlueprintName = "UI Tests"
ReferencedContainer = "container:PHP Monitor.xcodeproj">
</BuildableReference>
</TestableReference>

View File

@ -39,8 +39,30 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C4F7807825D7F84B000DBC97"
BuildableName = "phpmon-tests.xctest"
BlueprintName = "phpmon-tests"
BuildableName = "Unit Tests.xctest"
BlueprintName = "Unit Tests"
ReferencedContainer = "container:PHP Monitor.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C471E7AC28F9B4940021E251"
BuildableName = "Feature Tests.xctest"
BlueprintName = "Feature Tests"
ReferencedContainer = "container:PHP Monitor.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C471E7BB28F9B90F0021E251"
BuildableName = "UI Tests.xctest"
BlueprintName = "UI Tests"
ReferencedContainer = "container:PHP Monitor.xcodeproj">
</BuildableReference>
</TestableReference>

View File

@ -17,8 +17,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C4F7807825D7F84B000DBC97"
BuildableName = "phpmon-tests.xctest"
BlueprintName = "phpmon-tests"
BuildableName = "Unit Tests.xctest"
BlueprintName = "Unit Tests"
ReferencedContainer = "container:PHP Monitor.xcodeproj">
</BuildableReference>
</TestableReference>

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@ -42,6 +42,11 @@ extension String {
return count
}
func matches(pattern: String) -> Bool {
let pred = NSPredicate(format: "self LIKE %@", pattern)
return !NSArray(object: self).filtered(using: pred).isEmpty
}
subscript(r: Range<String.Index>) -> String {
let start = r.lowerBound
let end = r.upperBound
@ -98,5 +103,4 @@ extension String {
return ""
}
}
}

View File

@ -61,8 +61,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
#if DEBUG
logger.verbosity = .performance
// Use a "working" test configuration
TestableConfigurations.working.apply()
if let profile = CommandLine.arguments.first(where: { $0.matches(pattern: "--configuration:*") }) {
Self.initializeTestingProfile(profile.replacingOccurrences(of: "--configuration:", with: ""))
}
#endif
if CommandLine.arguments.contains("--v") {
@ -86,6 +87,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
self.phpEnvironment = PhpEnv.shared
}
static func initializeTestingProfile(_ profile: String) {
Log.info("The profile `\(profile)` is being requested...")
}
// MARK: - Lifecycle
/**

View File

@ -21,7 +21,7 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate, PhpSwitcherDelegate
/**
The status bar item with variable length.
*/
@MainActor let statusItem = NSStatusBar.system.statusItem(
let statusItem = NSStatusBar.system.statusItem(
withLength: NSStatusItem.variableLength
)

View File

@ -41,10 +41,25 @@
},
"testTargets" : [
{
"parallelizable" : true,
"target" : {
"containerPath" : "container:PHP Monitor.xcodeproj",
"identifier" : "C4F7807825D7F84B000DBC97",
"name" : "phpmon-tests"
"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"
}
}
],

View File

@ -0,0 +1,11 @@
//
// Feature_Tests.swift
// Feature Tests
//
// Created by Nico Verbruggen on 14/10/2022.
// Copyright © 2022 Nico Verbruggen. All rights reserved.
//
import XCTest
final class Feature_Tests: XCTestCase {}

35
tests/ui/UI_Tests.swift Normal file
View File

@ -0,0 +1,35 @@
//
// UI_Tests.swift
// UI Tests
//
// Created by Nico Verbruggen on 14/10/2022.
// Copyright © 2022 Nico Verbruggen. All rights reserved.
//
import XCTest
final class UI_Tests: XCTestCase {
override func setUpWithError() throws {
continueAfterFailure = false
TestableConfigurations.broken.apply()
}
override func tearDownWithError() throws {
}
func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launchArguments = ["--configuration:broken"]
app.launch()
}
/*
func testLaunchPerformance() throws {
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
}
*/
}