1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2026-04-02 09:30:08 +02:00

♻️ Add minimal Container boot

This commit is contained in:
2025-12-02 15:20:58 +01:00
parent c445c59ed8
commit 564e47f66e
14 changed files with 32 additions and 33 deletions

View File

@@ -9,20 +9,17 @@
import Testing
import Foundation
@Suite(.serialized) // serialized due to how unique temp directory works
struct RealFileSystemTest {
var filesystem: FileSystemProtocol
init() throws {
let container = Container()
container.bind()
let container = Container.real(minimal: true)
filesystem = container.filesystem
}
private func createUniqueTemporaryDirectory() -> String {
let tempDirectoryURL = NSURL.fileURL(withPath: NSTemporaryDirectory(), isDirectory: true)
let fullTempDirectoryPath = tempDirectoryURL.appendingPathComponent("phpmon-fs-tests").path
let fullTempDirectoryPath = tempDirectoryURL.appendingPathComponent("phpmon-fs-tests-\(UUID().uuidString)").path
try? FileManager.default.removeItem(atPath: fullTempDirectoryPath)
try! FileManager.default.createDirectory(atPath: fullTempDirectoryPath, withIntermediateDirectories: false)
return fullTempDirectoryPath

View File

@@ -9,13 +9,12 @@
import Testing
import Foundation
@Suite(.serialized)
struct RealShellTest {
var container: Container
init() async throws {
// Reset to the default shell
container = Container.real()
container = Container.real(minimal: true)
}
@Test func system_shell_is_default() async {

View File

@@ -9,7 +9,6 @@
import Testing
import Foundation
@Suite(.serialized)
struct TestableShellTest {
@Test func fake_shell_output_can_be_declared() async {
let greeting = BatchFakeShellOutput(items: [

View File

@@ -11,7 +11,7 @@ import Foundation
struct TestableConfigurationTest {
@Test func configuration_can_be_saved_as_json() async {
let container = Container.real()
let container = Container.real(minimal: true)
// WORKING
var configuration = TestableConfigurations.working

View File

@@ -13,8 +13,7 @@ struct RealWebApiTest {
private var container: Container
init() throws {
self.container = Container()
container.bind()
self.container = Container.real(minimal: true)
}
var WebApi: RealWebApi {