Skip to content

Commit 3fcdc47

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 b8e3172 commit 3fcdc47

9 files changed

+7
-67
lines changed

Tests/Other/TestCases/UnitTestCase/PFUnitTestCase.m

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 2 deletions
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

Lines changed: 0 additions & 16 deletions
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

Lines changed: 3 additions & 14 deletions
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
@@ -120,17 +120,6 @@ @interface ObjectSubclassTests : PFUnitTestCase
120120

121121
@implementation ObjectSubclassTests
122122

123-
///--------------------------------------
124-
#pragma mark - XCTestCase
125-
///--------------------------------------
126-
127-
- (void)tearDown {
128-
[PFObject unregisterSubclass:[TheFlash class]];
129-
[PFObject unregisterSubclass:[BarryAllen class]];
130-
131-
[super tearDown];
132-
}
133-
134123
///--------------------------------------
135124
#pragma mark - Tests
136125
///--------------------------------------

Tests/Unit/ObjectSubclassingControllerTests.m

Lines changed: 3 additions & 3 deletions
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

Lines changed: 1 addition & 2 deletions
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

Lines changed: 0 additions & 16 deletions
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

Lines changed: 0 additions & 9 deletions
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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,11 @@ - (void)testConstructorsClassNameValidation {
2525
}
2626

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

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

0 commit comments

Comments
 (0)