1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-11-07 05:10:06 +01:00

Fix issue with UI tests and .localizable

This commit is contained in:
2022-11-02 21:02:18 +01:00
parent 4de7179d1c
commit 76d96b3507
2 changed files with 21 additions and 9 deletions

View File

@@ -9,12 +9,24 @@ import SwiftUI
struct Localization {
static var bundle: Bundle = {
var bundle = Bundle.main
if isRunningTests {
bundle = Bundle(identifier: "com.nicoverbruggen.phpmon.dev")
?? Bundle(identifier: "com.nicoverbruggen.phpmon")!
if !isRunningTests {
return Bundle.main
}
return bundle
let foundBundle = Bundle(identifier: "com.nicoverbruggen.phpmon.dev")
?? Bundle(identifier: "com.nicoverbruggen.phpmon")
?? Bundle(identifier: "com.nicoverbruggen.phpmon.ui-tests")
if foundBundle == nil {
let bundles = Bundle.allBundles
.map { $0.bundleIdentifier }
.filter { $0 != nil }
.map { $0! }
fatalError("The following bundles were found: \(bundles)")
}
return foundBundle!
}()
}