Skip to content

Commit f466919

Browse files
committed
fix failing tests
1 parent 2ed7089 commit f466919

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

FirebaseFacebookAuthUI/FirebaseFacebookAuthUITests/FUIFacebookAuthTest.m

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,35 @@
1313
// See the License for the specific language governing permissions and
1414
// limitations under the License.
1515
//
16+
1617
#import "FUIFacebookAuthTest.h"
18+
#import <OCMock/OCMock.h>
1719
#import <FBSDKCoreKit/FBSDKCoreKit.h>
1820

19-
@interface FBSDKLoginManagerTest : FBSDKLoginManager
21+
@interface FUIFacebookAuthTest ()
2022
@property(nonatomic) FBSDKLoginManagerLoginResult *result;
2123
@property(nonatomic) NSError *error;
2224
@end
2325

24-
@implementation FBSDKLoginManagerTest
25-
26-
- (void)logInWithPermissions:(NSArray *)permissions
27-
fromViewController:(UIViewController *)fromViewController
28-
handler:(FBSDKLoginManagerLoginResultBlock)handler {
29-
handler(self.result, self.error);
30-
}
31-
@end
32-
33-
3426
@implementation FUIFacebookAuthTest
3527

3628
- (FBSDKLoginManager *)createLoginManager {
37-
return [[FBSDKLoginManagerTest alloc] init];
29+
id mock = OCMClassMock([FBSDKLoginManager class]);
30+
OCMStub(
31+
[mock logInWithPermissions:[OCMArg any]
32+
fromViewController:[OCMArg any]
33+
handler:[OCMArg any]]
34+
).andDo(^(NSInvocation *invocation) {
35+
void (^completion)(FBSDKLoginManagerLoginResult *, NSError *);
36+
[invocation getArgument:&completion atIndex:4];
37+
completion(self.result, self.error);
38+
});
39+
return mock;
3840
}
3941

4042
- (void)configureLoginManager:(FBSDKLoginManagerLoginResult *)result withError:(NSError *)error {
41-
((FBSDKLoginManagerTest *)_loginManager).result = result;
42-
((FBSDKLoginManagerTest *)_loginManager).error = error;
43+
self.result = result;
44+
self.error = error;
4345
}
4446

4547
@end

0 commit comments

Comments
 (0)