File tree Expand file tree Collapse file tree 2 files changed +21
-18
lines changed
FirebaseABTesting/Tests/Unit/Utilities Expand file tree Collapse file tree 2 files changed +21
-18
lines changed Original file line number Diff line number Diff line change 20
20
21
21
@implementation ABTTestUtilities
22
22
23
+ + (NSBundle *)getBundle {
24
+ #if SWIFT_PACKAGE
25
+ return Firebase_ABTestingUnit_SWIFTPM_MODULE_BUNDLE ();
26
+ #else
27
+ return [NSBundle bundleForClass: [ABTTestUtilities class ]];
28
+ #endif
29
+ }
30
+
23
31
+ (ABTExperimentPayload *)payloadFromTestFilename : (NSString *)filename {
24
- NSString *testJsonDataFilePath =
25
- [[ NSBundle bundleForClass: [ABTTestUtilities class ]] pathForResource: filename ofType: @" txt" ];
32
+ NSBundle *abtBundle = [ self getBundle ];
33
+ NSString *testJsonDataFilePath = [abtBundle pathForResource: filename ofType: @" txt" ];
26
34
NSError *readTextError = nil ;
27
35
NSString *fileText = [[NSString alloc ] initWithContentsOfFile: testJsonDataFilePath
28
36
encoding: NSUTF8StringEncoding
@@ -36,8 +44,8 @@ + (ABTExperimentPayload *)payloadFromTestFilename:(NSString *)filename {
36
44
37
45
+ (NSData *)payloadJSONDataFromFile : (NSString *)filename
38
46
modifiedStartTime : (nullable NSDate *)modifiedStartTime {
39
- NSString *testJsonDataFilePath =
40
- [[ NSBundle bundleForClass: [ABTTestUtilities class ]] pathForResource: filename ofType: @" txt" ];
47
+ NSBundle *abtBundle = [ self getBundle ];
48
+ NSString *testJsonDataFilePath = [abtBundle pathForResource: filename ofType: @" txt" ];
41
49
NSError *readTextError = nil ;
42
50
NSString *fileText = [[NSString alloc ] initWithContentsOfFile: testJsonDataFilePath
43
51
encoding: NSUTF8StringEncoding
Original file line number Diff line number Diff line change @@ -275,20 +275,15 @@ let package = Package(
275
275
. define( " FIRABTesting_VERSION " , to: " 0.0.1 " ) , // TODO: Fix version
276
276
]
277
277
) ,
278
- // Disabled. Pending resolution of accessing SPM resources from Objective C.
279
- // See https://forums.swift.org/t/finding-swift-package-manager-resources/38058
280
- // .testTarget(
281
- // name: "ABTestingUnit",
282
- // dependencies: ["FirebaseABTesting", "OCMock"],
283
- // path: "FirebaseABTesting/Tests/Unit",
284
- // resources: [.process("Resources")],
285
- //// resources: [
286
- ////
287
- //// "Resources/TestABTPayload1.txt"],
288
- // cSettings: [
289
- // .headerSearchPath("../../.."),
290
- // ]
291
- // ),
278
+ . testTarget(
279
+ name: " ABTestingUnit " ,
280
+ dependencies: [ " FirebaseABTesting " , " OCMock " ] ,
281
+ path: " FirebaseABTesting/Tests/Unit " ,
282
+ resources: [ . process( " Resources " ) ] ,
283
+ cSettings: [
284
+ . headerSearchPath( " ../../.. " ) ,
285
+ ]
286
+ ) ,
292
287
. target(
293
288
name: " FirebaseAuth " ,
294
289
dependencies: [ " FirebaseCore " ,
You can’t perform that action at this time.
0 commit comments