mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2026-04-02 09:30:08 +02:00
♻️ Lint tests, add background update check
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
// swiftlint:disable colon
|
||||
class TestableConfigurations {
|
||||
/** A functional, working system setup that is compatible with PHP Monitor. */
|
||||
static var working: TestableConfiguration {
|
||||
@@ -179,7 +180,9 @@ class TestableConfigurations {
|
||||
: .delayed(0.2, "OK"),
|
||||
"ln -sF ~/.config/valet/valet84.sock ~/.config/valet/valet.sock"
|
||||
: .instant("OK"),
|
||||
"/opt/homebrew/bin/brew update >/dev/null && /opt/homebrew/bin/brew outdated --json --formulae": .delayed(2.0, """
|
||||
"/opt/homebrew/bin/brew update >/dev/null && /opt/homebrew/bin/brew outdated --json --formulae"
|
||||
: .delayed(2.0,
|
||||
"""
|
||||
{
|
||||
"formulae": [
|
||||
{
|
||||
@@ -199,7 +202,7 @@ class TestableConfigurations {
|
||||
commandOutput: [
|
||||
"/opt/homebrew/bin/php -r echo ini_get('memory_limit');": "512M",
|
||||
"/opt/homebrew/bin/php -r echo ini_get('upload_max_filesize');": "512M",
|
||||
"/opt/homebrew/bin/php -r echo ini_get('post_max_size');": "512M",
|
||||
"/opt/homebrew/bin/php -r echo ini_get('post_max_size');": "512M"
|
||||
],
|
||||
preferenceOverrides: [
|
||||
.automaticBackgroundUpdateCheck: false
|
||||
@@ -223,6 +226,7 @@ class TestableConfigurations {
|
||||
return configuration
|
||||
}
|
||||
}
|
||||
// swiftlint:enable colon
|
||||
|
||||
class ShellStrings {
|
||||
static var shared = ShellStrings()
|
||||
|
||||
@@ -17,7 +17,7 @@ class FeatureTestCase: XCTestCase {
|
||||
return fs as! TestableFileSystem
|
||||
}
|
||||
|
||||
fatalError("The active filesystem is not a TestableFileSystem. Please use `ActiveFileSystem` to use the fake filesystem.")
|
||||
fatalError("The active filesystem is not a TestableFileSystem. Please use `ActiveFileSystem`.")
|
||||
}
|
||||
|
||||
public func assertFileSystemHas(
|
||||
@@ -44,6 +44,4 @@ class FeatureTestCase: XCTestCase {
|
||||
) {
|
||||
XCTAssertEqual(contents, fakeFileSystem.files[path]?.content, file: file, line: line)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ final class DomainsListTest: UITestCase {
|
||||
searchField.click()
|
||||
searchField.typeText("non-existent thing")
|
||||
Thread.sleep(forTimeInterval: 0.2)
|
||||
XCTAssertTrue(window.tables.tableRows.count == 0)
|
||||
XCTAssertTrue(window.tables.tableRows.count == 0) // swiftlint:disable:this empty_count
|
||||
|
||||
searchField.clearText()
|
||||
searchField.click()
|
||||
|
||||
@@ -26,7 +26,7 @@ final class StartupTest: UITestCase {
|
||||
assertAllExist([
|
||||
app.dialogs["generic.notice".localized],
|
||||
app.staticTexts["startup.errors.php_binary.title".localized],
|
||||
app.buttons["generic.ok".localized],
|
||||
app.buttons["generic.ok".localized]
|
||||
])
|
||||
click(app.buttons["generic.ok".localized])
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ final class ExtensionEnumeratorTest: XCTestCase {
|
||||
"\(Paths.tapPath)/shivammathur/homebrew-extensions/Formula/xdebug@8.1.rb": .fake(.text, "<test>"),
|
||||
"\(Paths.tapPath)/shivammathur/homebrew-extensions/Formula/xdebug@8.2.rb": .fake(.text, "<test>"),
|
||||
"\(Paths.tapPath)/shivammathur/homebrew-extensions/Formula/xdebug@8.3.rb": .fake(.text, "<test>"),
|
||||
"\(Paths.tapPath)/shivammathur/homebrew-extensions/Formula/xdebug@8.4.rb": .fake(.text, "<test>"),
|
||||
"\(Paths.tapPath)/shivammathur/homebrew-extensions/Formula/xdebug@8.4.rb": .fake(.text, "<test>")
|
||||
])
|
||||
}
|
||||
|
||||
@@ -37,5 +37,4 @@ final class ExtensionEnumeratorTest: XCTestCase {
|
||||
XCTAssertEqual(formulae["8.3"], [BrewPhpExtension(path: "/", name: "xdebug", phpVersion: "8.3")])
|
||||
XCTAssertEqual(formulae["8.4"], [BrewPhpExtension(path: "/", name: "xdebug", phpVersion: "8.4")])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ class ValetRcTest: XCTestCase {
|
||||
.url(forResource: "valetrc", withExtension: "broken")!
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Tests
|
||||
|
||||
func test_can_extract_fields_from_valetrc_file() throws {
|
||||
|
||||
@@ -71,8 +71,6 @@ class RealFileSystemTest: XCTestCase {
|
||||
return executablePath
|
||||
}
|
||||
|
||||
|
||||
|
||||
func test_can_read_file_as_text() {
|
||||
let temporaryDirectory = self.createUniqueTemporaryDirectory()
|
||||
let executable = self.createTestBinaryFile(temporaryDirectory)
|
||||
|
||||
@@ -30,7 +30,7 @@ class TestableShellTest: XCTestCase {
|
||||
|
||||
XCTAssertEqual("Hello world\nGoodbye world", output.out)
|
||||
}
|
||||
|
||||
|
||||
func test_fake_shell_synchronous_output() {
|
||||
let greeting = BatchFakeShellOutput(items: [
|
||||
.instant("Hello world\n"),
|
||||
|
||||
@@ -12,7 +12,7 @@ class TestableConfigurationTest: XCTestCase {
|
||||
func test_configuration_can_be_saved_as_json() async {
|
||||
// WORKING
|
||||
var configuration = TestableConfigurations.working
|
||||
|
||||
|
||||
try! configuration.toJson().write(
|
||||
toFile: NSHomeDirectory() + "/.phpmon_fconf_working.json",
|
||||
atomically: true,
|
||||
@@ -38,4 +38,3 @@ class TestableConfigurationTest: XCTestCase {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import XCTest
|
||||
|
||||
// swiftlint:disable type_body_length
|
||||
// swiftlint:disable type_body_length file_length
|
||||
class PhpVersionNumberTest: XCTestCase {
|
||||
|
||||
func test_can_deconstruct_php_version() throws {
|
||||
@@ -51,7 +51,6 @@ class PhpVersionNumberTest: XCTestCase {
|
||||
XCTAssertEqual(version!.minor, 0)
|
||||
}
|
||||
|
||||
|
||||
func test_can_check_wildcard_version_constraint() throws {
|
||||
// Wildcard for patch only
|
||||
XCTAssertEqual(
|
||||
@@ -408,3 +407,4 @@ class PhpVersionNumberTest: XCTestCase {
|
||||
)
|
||||
}
|
||||
}
|
||||
// swiftlint:enable type_body_length file_length
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import Testing
|
||||
|
||||
@Suite("Commands")
|
||||
@Suite("Commands")
|
||||
struct CommandTest {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -18,7 +18,7 @@ struct ValetConfigurationTest {
|
||||
)!
|
||||
}
|
||||
|
||||
@Test("Can load config file")
|
||||
@Test("Can load config file")
|
||||
func can_load_config_file() throws {
|
||||
let json = try? String(
|
||||
contentsOf: Self.jsonConfigFileUrl,
|
||||
|
||||
Reference in New Issue
Block a user