This repository was archived by the owner on Jan 16, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 1010#import " PFFacebookUtils.h"
1111
1212#import < Bolts/BFExecutor.h>
13-
1413#import < FBSDKCoreKit/FBSDKCoreKit.h>
14+ #import < Parse/Parse.h>
1515
1616#import " PFFacebookPrivateUtilities.h"
1717
@@ -48,6 +48,10 @@ + (void)_setAuthenticationProvider:(PFFacebookAuthenticationProvider *)provider
4848// /--------------------------------------
4949
5050+ (void )initializeFacebookWithApplicationLaunchOptions : (NSDictionary *)launchOptions {
51+ if (![Parse currentConfiguration ]) {
52+ // TODO: (nlutsenko) Remove this when Parse SDK throws on every access to Parse._currentManager
53+ [NSException raise: NSInternalInconsistencyException format: @" PFFacebookUtils must be initialized after initializing Parse." ];
54+ }
5155 if (!authenticationProvider_) {
5256 Class providerClass = nil ;
5357#if TARGET_OS_IOS
Original file line number Diff line number Diff line change 77 * of patent rights can be found in the PATENTS file in the same directory.
88 */
99
10- @import Parse.PFConstants ;
10+ @import Parse;
1111
1212#import < OCMock/OCMock.h>
1313
@@ -57,9 +57,14 @@ - (void)testInitialize {
5757
5858 XCTAssertThrows ([PFFacebookUtils unlinkUserInBackground: userMock]);
5959
60- [PFFacebookUtils initializeFacebookWithApplicationLaunchOptions: nil ];
61- XCTAssertNotNil ([PFFacebookUtils _authenticationProvider ]);
60+ XCTAssertThrows ([PFFacebookUtils initializeFacebookWithApplicationLaunchOptions: nil ]);
61+
62+ id parseMock = PFStrictClassMock ([Parse class ]);
63+ id configurationMock = PFStrictClassMock ([ParseClientConfiguration class ]);
64+ OCMStub (ClassMethod ([parseMock currentConfiguration ])).andReturn (configurationMock);
6265
66+ XCTAssertNoThrow ([PFFacebookUtils initializeFacebookWithApplicationLaunchOptions: nil ]);
67+ XCTAssertNotNil ([PFFacebookUtils _authenticationProvider ]);
6368 XCTAssertNoThrow ([PFFacebookUtils initializeFacebookWithApplicationLaunchOptions: nil ]);
6469
6570 OCMVerifyAll (userMock);
You can’t perform that action at this time.
0 commit comments