mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 03:50:08 +02:00
👌 Read configuration from JSON file
This allows us to alter the configuration prior to launching the app, which allows for additional flexibility during testing.
This commit is contained in:
21
tests/unit/Testables/TestableConfigurationTest.swift
Normal file
21
tests/unit/Testables/TestableConfigurationTest.swift
Normal file
@ -0,0 +1,21 @@
|
||||
//
|
||||
// TestableConfigurationTest.swift
|
||||
// PHP Monitor
|
||||
//
|
||||
// Created by Nico Verbruggen on 16/10/2022.
|
||||
// Copyright © 2022 Nico Verbruggen. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
class TestableConfigurationTest: XCTestCase {
|
||||
func test_configuration_can_be_saved_as_json() async {
|
||||
var configuration = TestableConfigurations.working
|
||||
configuration.filesystem["/opt/homebrew/bin/php"] = nil
|
||||
print(configuration.filesystem.keys)
|
||||
let json = configuration.toJson()
|
||||
try! json.write(toFile: "/tmp/pmc_working.json", atomically: true, encoding: .utf8)
|
||||
try! json.write(toFile: "/tmp/pmc_broken.json", atomically: true, encoding: .utf8)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user