|
@@ -8,6 +8,20 @@
|
8
|
8
|
#import "RNNErrorHandler.h"
|
9
|
9
|
#import <OCMock/OCMock.h>
|
10
|
10
|
|
|
11
|
+@interface MockUIApplication : NSObject
|
|
12
|
+
|
|
13
|
+-(UIWindow *)keyWindow;
|
|
14
|
+
|
|
15
|
+@end
|
|
16
|
+
|
|
17
|
+@implementation MockUIApplication
|
|
18
|
+
|
|
19
|
+- (UIWindow *)keyWindow {
|
|
20
|
+ return [UIWindow new];
|
|
21
|
+}
|
|
22
|
+
|
|
23
|
+@end
|
|
24
|
+
|
11
|
25
|
@interface MockUINavigationController : RNNNavigationController
|
12
|
26
|
@property (nonatomic, strong) NSArray* willReturnVCs;
|
13
|
27
|
@end
|
|
@@ -33,6 +47,7 @@
|
33
|
47
|
@property (nonatomic, strong) RNNRootViewController* vc3;
|
34
|
48
|
@property (nonatomic, strong) MockUINavigationController* nvc;
|
35
|
49
|
@property (nonatomic, strong) id mainWindow;
|
|
50
|
+@property (nonatomic, strong) id sharedApplication;
|
36
|
51
|
@property (nonatomic, strong) id controllerFactory;
|
37
|
52
|
@property (nonatomic, strong) id overlayManager;
|
38
|
53
|
@property (nonatomic, strong) id eventEmmiter;
|
|
@@ -43,12 +58,13 @@
|
43
|
58
|
|
44
|
59
|
- (void)setUp {
|
45
|
60
|
[super setUp];
|
|
61
|
+ self.sharedApplication = [OCMockObject mockForClass:[UIApplication class]];
|
46
|
62
|
self.mainWindow = [OCMockObject partialMockForObject:[UIWindow new]];
|
47
|
63
|
self.store = [OCMockObject partialMockForObject:[[RNNStore alloc] init]];
|
48
|
64
|
self.eventEmmiter = [OCMockObject partialMockForObject:[RNNEventEmitter new]];
|
49
|
65
|
self.overlayManager = [OCMockObject partialMockForObject:[RNNOverlayManager new]];
|
50
|
66
|
self.controllerFactory = [OCMockObject partialMockForObject:[[RNNControllerFactory alloc] initWithRootViewCreator:nil eventEmitter:self.eventEmmiter andBridge:nil]];
|
51
|
|
- self.uut = [[RNNCommandsHandler alloc] initWithStore:self.store controllerFactory:self.controllerFactory eventEmitter:self.eventEmmiter stackManager:[RNNNavigationStackManager new] modalManager:[RNNModalManager new] overlayManager:self.overlayManager mainWindow:self.mainWindow];
|
|
67
|
+ self.uut = [[RNNCommandsHandler alloc] initWithStore:self.store controllerFactory:self.controllerFactory eventEmitter:self.eventEmmiter stackManager:[RNNNavigationStackManager new] modalManager:[RNNModalManager new] overlayManager:self.overlayManager sharedApplication:_sharedApplication];
|
52
|
68
|
self.vc1 = [RNNRootViewController new];
|
53
|
69
|
self.vc2 = [RNNRootViewController new];
|
54
|
70
|
self.vc3 = [RNNRootViewController new];
|
|
@@ -57,6 +73,7 @@
|
57
|
73
|
[self.store setComponent:self.vc1 componentId:@"vc1"];
|
58
|
74
|
[self.store setComponent:self.vc2 componentId:@"vc2"];
|
59
|
75
|
[self.store setComponent:self.vc3 componentId:@"vc3"];
|
|
76
|
+ OCMStub([self.sharedApplication keyWindow]).andReturn(self.mainWindow);
|
60
|
77
|
}
|
61
|
78
|
|
62
|
79
|
|
|
@@ -75,7 +92,7 @@
|
75
|
92
|
-(NSArray*) getPublicMethodNamesForObject:(NSObject*)obj{
|
76
|
93
|
NSMutableArray* skipMethods = [NSMutableArray new];
|
77
|
94
|
|
78
|
|
- [skipMethods addObject:@"initWithStore:controllerFactory:eventEmitter:stackManager:modalManager:overlayManager:mainWindow:"];
|
|
95
|
+ [skipMethods addObject:@"initWithStore:controllerFactory:eventEmitter:stackManager:modalManager:overlayManager:sharedApplication:"];
|
79
|
96
|
[skipMethods addObject:@"assertReady"];
|
80
|
97
|
[skipMethods addObject:@"removePopedViewControllers:"];
|
81
|
98
|
[skipMethods addObject:@".cxx_destruct"];
|