mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2026-04-06 19:10:08 +02:00
♻️ Add minimal Container boot
This commit is contained in:
@@ -9,12 +9,11 @@
|
||||
import Testing
|
||||
import Foundation
|
||||
|
||||
@Suite(.serialized)
|
||||
struct CaskFileParserTest {
|
||||
var container: Container
|
||||
|
||||
init() async throws {
|
||||
container = Container.real()
|
||||
container = Container.real(minimal: true)
|
||||
}
|
||||
|
||||
var Shell: ShellProtocol {
|
||||
|
||||
@@ -53,7 +53,7 @@ struct HomebrewPackageTest {
|
||||
/// or the JSON API of the Homebrew output may have changed.
|
||||
@Test(.disabled("Uses system command; enable at your own risk"))
|
||||
func can_parse_services_json_from_cli_output() async throws {
|
||||
let container = Container.real()
|
||||
let container = Container.real(minimal: true)
|
||||
|
||||
let services = try! JSONDecoder().decode(
|
||||
[HomebrewService].self,
|
||||
@@ -76,7 +76,7 @@ struct HomebrewPackageTest {
|
||||
/// or the JSON API of the Homebrew output may have changed.
|
||||
@Test(.disabled("Uses system command; enable at your own risk"))
|
||||
func can_load_extension_json_from_cli_output() async throws {
|
||||
let container = Container.real()
|
||||
let container = Container.real(minimal: true)
|
||||
|
||||
let package = try! JSONDecoder().decode(
|
||||
[HomebrewPackage].self,
|
||||
|
||||
@@ -13,7 +13,7 @@ struct NginxConfigurationTest {
|
||||
var container: Container
|
||||
|
||||
init () async throws {
|
||||
container = Container.real()
|
||||
container = Container.real(minimal: true)
|
||||
}
|
||||
|
||||
// MARK: - Test Files
|
||||
|
||||
@@ -9,12 +9,11 @@
|
||||
import Testing
|
||||
import Foundation
|
||||
|
||||
@Suite(.serialized)
|
||||
class PhpConfigurationFileTest {
|
||||
var container: Container
|
||||
|
||||
init() {
|
||||
self.container = Container.real()
|
||||
self.container = Container.real(minimal: true)
|
||||
}
|
||||
|
||||
static var phpIniFileUrl: URL {
|
||||
|
||||
@@ -9,25 +9,22 @@
|
||||
import Testing
|
||||
import Foundation
|
||||
|
||||
@Suite(.serialized)
|
||||
struct PhpExtensionTest {
|
||||
var container: Container
|
||||
|
||||
init () async throws {
|
||||
container = Container.real()
|
||||
}
|
||||
|
||||
static var phpIniFileUrl: URL {
|
||||
TestBundle.url(forResource: "php", withExtension: "ini")!
|
||||
}
|
||||
|
||||
@Test func can_load_extension() throws {
|
||||
let container = Container.real(minimal: true)
|
||||
|
||||
let extensions = PhpExtension.from(container, filePath: Self.phpIniFileUrl.path)
|
||||
|
||||
#expect(!extensions.isEmpty)
|
||||
}
|
||||
|
||||
@Test func extension_name_is_correct() throws {
|
||||
let container = Container.real(minimal: true)
|
||||
|
||||
let extensions = PhpExtension.from(container, filePath: Self.phpIniFileUrl.path)
|
||||
|
||||
let extensionNames = extensions.map { (ext) -> String in
|
||||
@@ -47,6 +44,8 @@ struct PhpExtensionTest {
|
||||
}
|
||||
|
||||
@Test func extension_status_is_correct() throws {
|
||||
let container = Container.real(minimal: true)
|
||||
|
||||
let extensions = PhpExtension.from(container, filePath: Self.phpIniFileUrl.path)
|
||||
|
||||
// xdebug should be enabled
|
||||
@@ -57,6 +56,7 @@ struct PhpExtensionTest {
|
||||
}
|
||||
|
||||
@Test func toggle_works_as_expected() async throws {
|
||||
let container = Container.real(minimal: true)
|
||||
let destination = Utility.copyToTemporaryFile(resourceName: "php", fileExtension: "ini")!
|
||||
let extensions = PhpExtension.from(container, filePath: destination.path)
|
||||
#expect(extensions.count == 6)
|
||||
|
||||
Reference in New Issue
Block a user