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:
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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: [
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user