Skip to content

Commit 2f81142

Browse files
Updated tests to work with new automatic registration.
Some of these were testing subclass registration, so make sure those don't get automatically registered. For everything else, just remove registration code.
1 parent 22a69f8 commit 2f81142

9 files changed

+7
-79
lines changed

Tests/Other/TestCases/UnitTestCase/PFUnitTestCase.m

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ - (void)setUp {
4242
- (void)tearDown {
4343
[[Parse _currentManager] clearEventuallyQueue];
4444
[Parse _clearCurrentManager];
45-
[PFObjectSubclassingController clearDefaultController];
4645

4746
[super tearDown];
4847
}

Tests/Unit/ACLUnitTests.m

-2
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,6 @@ - (void)testDefaultACL {
218218
}
219219

220220
- (void)testACLRequiresObjectId {
221-
[PFUser registerSubclass];
222-
223221
PFACL *acl = [PFACL ACL];
224222
#pragma clang diagnostic push
225223
#pragma clang diagnostic ignored "-Wnonnull"

Tests/Unit/ObjectSubclassPropertiesTests.m

-16
Original file line numberDiff line numberDiff line change
@@ -105,22 +105,6 @@ @interface ObjectSubclassPropertiesTests : PFUnitTestCase
105105

106106
@implementation ObjectSubclassPropertiesTests
107107

108-
///--------------------------------------
109-
#pragma mark - XCTestCase
110-
///--------------------------------------
111-
112-
- (void)setUp {
113-
[super setUp];
114-
115-
[PFTestObject registerSubclass];
116-
}
117-
118-
- (void)tearDown {
119-
[PFObject unregisterSubclass:[PFTestObject class]];
120-
121-
[super tearDown];
122-
}
123-
124108
///--------------------------------------
125109
#pragma mark - Tests
126110
///--------------------------------------

Tests/Unit/ObjectSubclassTests.m

+3-26
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#pragma mark - Helpers
1818
///--------------------------------------
1919

20-
@interface TheFlash : PFObject<PFSubclassing> {
20+
@interface TheFlash : PFObject<PFSubclassingSkipAutomaticRegistration> {
2121
NSString *flashName;
2222
}
2323

@@ -59,7 +59,7 @@ + (NSString *)parseClassName {
5959

6060
@end
6161

62-
@interface ClassWithDirtyingConstructor : PFObject<PFSubclassing>
62+
@interface ClassWithDirtyingConstructor : PFObject<PFSubclassingSkipAutomaticRegistration>
6363
@end
6464

6565
@implementation ClassWithDirtyingConstructor
@@ -85,7 +85,7 @@ @interface UtilityClass : PFObject
8585
@implementation UtilityClass
8686
@end
8787

88-
@interface DescendantOfUtility : UtilityClass<PFSubclassing>
88+
@interface DescendantOfUtility : UtilityClass<PFSubclassingSkipAutomaticRegistration>
8989
@end
9090

9191
@implementation DescendantOfUtility
@@ -104,17 +104,6 @@ @interface ObjectSubclassTests : PFUnitTestCase
104104

105105
@implementation ObjectSubclassTests
106106

107-
///--------------------------------------
108-
#pragma mark - XCTestCase
109-
///--------------------------------------
110-
111-
- (void)tearDown {
112-
[PFObject unregisterSubclass:[TheFlash class]];
113-
[PFObject unregisterSubclass:[BarryAllen class]];
114-
115-
[super tearDown];
116-
}
117-
118107
///--------------------------------------
119108
#pragma mark - Tests
120109
///--------------------------------------
@@ -158,16 +147,4 @@ - (void)testSubclassesCanInheritUtilityClassesWithoutParseClassName {
158147
[DescendantOfUtility registerSubclass];
159148
}
160149

161-
- (void)testSubclassRegistrationBeforeInitializingParse {
162-
[[Parse _currentManager] clearEventuallyQueue];
163-
[Parse _clearCurrentManager];
164-
165-
[TheFlash registerSubclass];
166-
167-
[Parse setApplicationId:@"a" clientKey:@"b"];
168-
169-
PFObject *theFlash = [PFObject objectWithClassName:@"Person"];
170-
PFAssertIsKindOfClass(theFlash, [TheFlash class]);
171-
}
172-
173150
@end

Tests/Unit/ObjectSubclassingControllerTests.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
#import "PFUnitTestCase.h"
1616
#import "ParseUnitTests-Swift.h"
1717

18-
@interface TestSubclass : PFObject<PFSubclassing>
18+
@interface TestSubclass : PFObject<PFSubclassingSkipAutomaticRegistration>
1919
@end
2020

21-
@interface NotSubclass : PFObject<PFSubclassing>
21+
@interface NotSubclass : PFObject<PFSubclassingSkipAutomaticRegistration>
2222
@end
2323

24-
@interface PropertySubclass : PFObject<PFSubclassing> {
24+
@interface PropertySubclass : PFObject<PFSubclassingSkipAutomaticRegistration> {
2525
@public
2626
id _ivarProperty;
2727
}

Tests/Unit/OfflineQueryLogicUnitTests.m

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@ @implementation OfflineQueryLogicUnitTests
2929
- (void)setUp {
3030
[super setUp];
3131

32-
[PFUser registerSubclass];
3332
_user = [PFUser user];
3433
}
3534

3635
- (void)tearDown {
37-
[PFObject unregisterSubclass:[PFUser class]];
36+
_user = nil;
3837

3938
[super tearDown];
4039
}

Tests/Unit/SessionControllerTests.m

-16
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,6 @@ @interface SessionControllerTests : PFUnitTestCase
2525

2626
@implementation SessionControllerTests
2727

28-
///--------------------------------------
29-
#pragma mark - XCTestCase
30-
///--------------------------------------
31-
32-
- (void)setUp {
33-
[super setUp];
34-
35-
[PFSession registerSubclass];
36-
}
37-
38-
- (void)tearDown {
39-
[PFObject unregisterSubclass:[PFSession class]];
40-
41-
[super tearDown];
42-
}
43-
4428
///--------------------------------------
4529
#pragma mark - Helpers
4630
///--------------------------------------

Tests/Unit/SessionUnitTests.m

-9
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,7 @@ - (PFSessionController *)sessionControllerMockWithSessionResult:(PFSession *)ses
4444
///--------------------------------------
4545

4646
- (void)testSessionClassIsRegistered {
47-
[PFObject unregisterSubclass:[PFSession class]];
48-
[Parse setApplicationId:@"a" clientKey:@"b"];
4947
XCTAssertNotNil([PFSession query]);
50-
51-
[[Parse _currentManager] clearEventuallyQueue];
52-
[Parse _clearCurrentManager];
5348
}
5449

5550
- (void)testConstructorsClassNameValidation {
@@ -58,8 +53,6 @@ - (void)testConstructorsClassNameValidation {
5853
}
5954

6055
- (void)testSessionImmutableFieldsCannotBeChanged {
61-
[PFSession registerSubclass];
62-
6356
PFSession *session = [PFSession object];
6457
session[@"yolo"] = @"El Capitan!"; // Test for regular mutability
6558
PFAssertThrowsInvalidArgumentException(session[@"sessionToken"] = @"a");
@@ -71,8 +64,6 @@ - (void)testSessionImmutableFieldsCannotBeChanged {
7164
}
7265

7366
- (void)testSessionImmutableFieldsCannotBeDeleted {
74-
[PFSession registerSubclass];
75-
7667
PFSession *session = [PFSession object];
7768

7869
[session removeObjectForKey:@"yolo"];// Test for regular mutability

Tests/Unit/UserUnitTests.m

-4
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,11 @@ - (void)testConstructorsClassNameValidation {
2626
}
2727

2828
- (void)testImmutableFieldsCannotBeChanged {
29-
[PFUser registerSubclass];
30-
3129
PFUser *user = [PFUser object];
3230
PFAssertThrowsInvalidArgumentException(user[@"sessionToken"] = @"a");
3331
}
3432

3533
- (void)testImmutableFieldsCannotBeDeleted {
36-
[PFUser registerSubclass];
37-
3834
PFUser *user = [PFUser object];
3935
PFAssertThrowsInvalidArgumentException([user removeObjectForKey:@"username"]);
4036
PFAssertThrowsInvalidArgumentException([user removeObjectForKey:@"sessionToken"]);

0 commit comments

Comments
 (0)