Skip to content

Commit cec5be5

Browse files
authored
Clean up mix of OCMock V2 and V3 syntax (#11032)
1 parent cc022a6 commit cec5be5

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

FirebaseCore/Tests/Unit/FIRBundleUtilTest.m

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ - (void)testRelevantBundles_mainIsFirst {
4444
// once the use-case is understood.
4545

4646
- (void)testFindOptionsDictionaryPath {
47-
[OCMStub([self.mockBundle pathForResource:kResourceName ofType:kFileType]) andReturn:kResultPath];
47+
OCMStub([self.mockBundle pathForResource:kResourceName ofType:kFileType]).andReturn(kResultPath);
4848
XCTAssertEqualObjects([FIRBundleUtil optionsDictionaryPathWithResourceName:kResourceName
4949
andFileType:kFileType
5050
inBundles:@[ self.mockBundle ]],
@@ -59,7 +59,7 @@ - (void)testFindOptionsDictionaryPath_notFound {
5959

6060
- (void)testFindOptionsDictionaryPath_secondBundle {
6161
NSBundle *mockBundleEmpty = OCMClassMock([NSBundle class]);
62-
[OCMStub([self.mockBundle pathForResource:kResourceName ofType:kFileType]) andReturn:kResultPath];
62+
OCMStub([self.mockBundle pathForResource:kResourceName ofType:kFileType]).andReturn(kResultPath);
6363

6464
NSArray *bundles = @[ mockBundleEmpty, self.mockBundle ];
6565
XCTAssertEqualObjects([FIRBundleUtil optionsDictionaryPathWithResourceName:kResourceName
@@ -70,12 +70,12 @@ - (void)testFindOptionsDictionaryPath_secondBundle {
7070

7171
- (void)testBundleIdentifierExistsInBundles {
7272
NSString *bundleID = @"com.google.test";
73-
[OCMStub([self.mockBundle bundleIdentifier]) andReturn:bundleID];
73+
OCMStub([self.mockBundle bundleIdentifier]).andReturn(bundleID);
7474
XCTAssertTrue([FIRBundleUtil hasBundleIdentifierPrefix:bundleID inBundles:@[ self.mockBundle ]]);
7575
}
7676

7777
- (void)testBundleIdentifierExistsInBundles_notExist {
78-
[OCMStub([self.mockBundle bundleIdentifier]) andReturn:@"com.google.test"];
78+
OCMStub([self.mockBundle bundleIdentifier]).andReturn(@"com.google.test");
7979
XCTAssertFalse([FIRBundleUtil hasBundleIdentifierPrefix:@"not-exist"
8080
inBundles:@[ self.mockBundle ]]);
8181
}
@@ -89,7 +89,7 @@ - (void)testBundleIdentifierHasPrefixInBundlesForExtension {
8989
[[[environmentUtilsMock stub] andReturnValue:@(YES)] isAppExtension];
9090

9191
// Mock bundle should have what app extension has, the extension bundle ID.
92-
[OCMStub([self.mockBundle bundleIdentifier]) andReturn:@"com.google.test.someextension"];
92+
OCMStub([self.mockBundle bundleIdentifier]).andReturn(@"com.google.test.someextension");
9393
XCTAssertTrue([FIRBundleUtil hasBundleIdentifierPrefix:@"com.google.test"
9494
inBundles:@[ self.mockBundle ]]);
9595

@@ -101,7 +101,7 @@ - (void)testBundleIdentifierExistsInBundlesForExtensions_exactMatch {
101101
[[[environmentUtilsMock stub] andReturnValue:@(YES)] isAppExtension];
102102

103103
// Mock bundle should have what app extension has, the extension bundle ID.
104-
[OCMStub([self.mockBundle bundleIdentifier]) andReturn:@"com.google.test.someextension"];
104+
OCMStub([self.mockBundle bundleIdentifier]).andReturn(@"com.google.test.someextension");
105105
XCTAssertTrue([FIRBundleUtil hasBundleIdentifierPrefix:@"com.google.test.someextension"
106106
inBundles:@[ self.mockBundle ]]);
107107

@@ -112,19 +112,19 @@ - (void)testBundleIdentifierHasPrefixInBundlesNotValidExtension {
112112
id environmentUtilsMock = [OCMockObject mockForClass:[GULAppEnvironmentUtil class]];
113113
[[[environmentUtilsMock stub] andReturnValue:@(YES)] isAppExtension];
114114

115-
[OCMStub([self.mockBundle bundleIdentifier]) andReturn:@"com.google.test.someextension.some"];
115+
OCMStub([self.mockBundle bundleIdentifier]).andReturn(@"com.google.test.someextension.some");
116116
XCTAssertFalse([FIRBundleUtil hasBundleIdentifierPrefix:@"com.google.test"
117117
inBundles:@[ self.mockBundle ]]);
118118

119-
[OCMStub([self.mockBundle bundleIdentifier]) andReturn:@"com.google.testsomeextension"];
119+
OCMStub([self.mockBundle bundleIdentifier]).andReturn(@"com.google.testsomeextension");
120120
XCTAssertFalse([FIRBundleUtil hasBundleIdentifierPrefix:@"com.google.test"
121121
inBundles:@[ self.mockBundle ]]);
122122

123-
[OCMStub([self.mockBundle bundleIdentifier]) andReturn:@"com.google.testsomeextension.some"];
123+
OCMStub([self.mockBundle bundleIdentifier]).andReturn(@"com.google.testsomeextension.some");
124124
XCTAssertFalse([FIRBundleUtil hasBundleIdentifierPrefix:@"com.google.test"
125125
inBundles:@[ self.mockBundle ]]);
126126

127-
[OCMStub([self.mockBundle bundleIdentifier]) andReturn:@"not-exist"];
127+
OCMStub([self.mockBundle bundleIdentifier]).andReturn(@"not-exist");
128128
XCTAssertFalse([FIRBundleUtil hasBundleIdentifierPrefix:@"com.google.test"
129129
inBundles:@[ self.mockBundle ]]);
130130

FirebaseCore/Tests/Unit/FIROptionsTest.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,19 @@ - (void)testInit {
5757

5858
- (void)testDefaultOptionsDictionaryWithNilFilePath {
5959
id mockBundleUtil = OCMClassMock([FIRBundleUtil class]);
60-
[OCMStub([mockBundleUtil optionsDictionaryPathWithResourceName:kServiceInfoFileName
61-
andFileType:kServiceInfoFileType
62-
inBundles:[FIRBundleUtil relevantBundles]])
63-
andReturn:nil];
60+
OCMStub([mockBundleUtil optionsDictionaryPathWithResourceName:kServiceInfoFileName
61+
andFileType:kServiceInfoFileType
62+
inBundles:[FIRBundleUtil relevantBundles]])
63+
.andReturn(nil);
6464
XCTAssertNil([FIROptions defaultOptionsDictionary]);
6565
}
6666

6767
- (void)testDefaultOptionsDictionaryWithInvalidSourceFile {
6868
id mockBundleUtil = OCMClassMock([FIRBundleUtil class]);
69-
[OCMStub([mockBundleUtil optionsDictionaryPathWithResourceName:kServiceInfoFileName
70-
andFileType:kServiceInfoFileType
71-
inBundles:[FIRBundleUtil relevantBundles]])
72-
andReturn:@"invalid.plist"];
69+
OCMStub([mockBundleUtil optionsDictionaryPathWithResourceName:kServiceInfoFileName
70+
andFileType:kServiceInfoFileType
71+
inBundles:[FIRBundleUtil relevantBundles]])
72+
.andReturn(@"invalid.plist");
7373
XCTAssertNil([FIROptions defaultOptionsDictionary]);
7474
}
7575

0 commit comments

Comments
 (0)