Authored by 周蓉君

去除无用target,增加单元测试工具类OCMock。Review by 阿瑟。

  1 +/*
  2 + * Copyright (c) 2009-2014 Erik Doernenburg and contributors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License"); you may
  5 + * not use these files except in compliance with the License. You may obtain
  6 + * a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12 + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13 + * License for the specific language governing permissions and limitations
  14 + * under the License.
  15 + */
  16 +
  17 +#import <Foundation/Foundation.h>
  18 +
  19 +@class OCObserverMockObject;
  20 +
  21 +
  22 +@interface NSNotificationCenter(OCMAdditions)
  23 +
  24 +- (void)addMockObserver:(OCObserverMockObject *)notificationObserver name:(NSString *)notificationName object:(id)notificationSender;
  25 +
  26 +@end
  1 +/*
  2 + * Copyright (c) 2009-2014 Erik Doernenburg and contributors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License"); you may
  5 + * not use these files except in compliance with the License. You may obtain
  6 + * a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12 + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13 + * License for the specific language governing permissions and limitations
  14 + * under the License.
  15 + */
  16 +
  17 +#import <Foundation/Foundation.h>
  18 +
  19 +@interface OCMArg : NSObject
  20 +
  21 +// constraining arguments
  22 +
  23 ++ (id)any;
  24 ++ (SEL)anySelector;
  25 ++ (void *)anyPointer;
  26 ++ (id __autoreleasing *)anyObjectRef;
  27 ++ (id)isNil;
  28 ++ (id)isNotNil;
  29 ++ (id)isEqual:(id)value;
  30 ++ (id)isNotEqual:(id)value;
  31 ++ (id)isKindOfClass:(Class)cls;
  32 ++ (id)checkWithSelector:(SEL)selector onObject:(id)anObject;
  33 ++ (id)checkWithBlock:(BOOL (^)(id obj))block;
  34 +
  35 +// manipulating arguments
  36 +
  37 ++ (id *)setTo:(id)value;
  38 ++ (void *)setToValue:(NSValue *)value;
  39 +
  40 +// internal use only
  41 +
  42 ++ (id)resolveSpecialValues:(NSValue *)value;
  43 +
  44 +@end
  45 +
  46 +#define OCMOCK_ANY [OCMArg any]
  47 +
  48 +#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
  49 + #define OCMOCK_VALUE(variable) \
  50 + ({ __typeof__(variable) __v = (variable); [NSValue value:&__v withObjCType:@encode(__typeof__(__v))]; })
  51 +#else
  52 + #define OCMOCK_VALUE(variable) [NSValue value:&variable withObjCType:@encode(__typeof__(variable))]
  53 +#endif
  1 +/*
  2 + * Copyright (c) 2007-2014 Erik Doernenburg and contributors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License"); you may
  5 + * not use these files except in compliance with the License. You may obtain
  6 + * a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12 + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13 + * License for the specific language governing permissions and limitations
  14 + * under the License.
  15 + */
  16 +
  17 +#import <Foundation/Foundation.h>
  18 +
  19 +
  20 +@interface OCMConstraint : NSObject
  21 +
  22 ++ (instancetype)constraint;
  23 +- (BOOL)evaluate:(id)value;
  24 +
  25 +// if you are looking for any, isNil, etc, they have moved to OCMArg
  26 +
  27 +// try to use [OCMArg checkWith...] instead of the constraintWith... methods below
  28 +
  29 ++ (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject;
  30 ++ (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject withValue:(id)aValue;
  31 +
  32 +
  33 +@end
  34 +
  35 +@interface OCMAnyConstraint : OCMConstraint
  36 +@end
  37 +
  38 +@interface OCMIsNilConstraint : OCMConstraint
  39 +@end
  40 +
  41 +@interface OCMIsNotNilConstraint : OCMConstraint
  42 +@end
  43 +
  44 +@interface OCMIsNotEqualConstraint : OCMConstraint
  45 +{
  46 + @public
  47 + id testValue;
  48 +}
  49 +
  50 +@end
  51 +
  52 +@interface OCMInvocationConstraint : OCMConstraint
  53 +{
  54 + @public
  55 + NSInvocation *invocation;
  56 +}
  57 +
  58 +@end
  59 +
  60 +@interface OCMBlockConstraint : OCMConstraint
  61 +{
  62 + BOOL (^block)(id);
  63 +}
  64 +
  65 +- (instancetype)initWithConstraintBlock:(BOOL (^)(id))block;
  66 +
  67 +@end
  68 +
  69 +
  70 +#define CONSTRAINT(aSelector) [OCMConstraint constraintWithSelector:aSelector onObject:self]
  71 +#define CONSTRAINTV(aSelector, aValue) [OCMConstraint constraintWithSelector:aSelector onObject:self withValue:(aValue)]
  1 +/*
  2 + * Copyright (c) 2014 Erik Doernenburg and contributors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License"); you may
  5 + * not use these files except in compliance with the License. You may obtain
  6 + * a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12 + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13 + * License for the specific language governing permissions and limitations
  14 + * under the License.
  15 + */
  16 +
  17 +#import <Foundation/Foundation.h>
  18 +
  19 +@interface OCMLocation : NSObject
  20 +{
  21 + id testCase;
  22 + NSString *file;
  23 + NSUInteger line;
  24 +}
  25 +
  26 ++ (instancetype)locationWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine;
  27 +
  28 +- (instancetype)initWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine;
  29 +
  30 +- (id)testCase;
  31 +- (NSString *)file;
  32 +- (NSUInteger)line;
  33 +
  34 +@end
  35 +
  36 +extern OCMLocation *OCMMakeLocation(id testCase, const char *file, int line);
  1 +/*
  2 + * Copyright (c) 2014 Erik Doernenburg and contributors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License"); you may
  5 + * not use these files except in compliance with the License. You may obtain
  6 + * a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12 + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13 + * License for the specific language governing permissions and limitations
  14 + * under the License.
  15 + */
  16 +
  17 +#import <Foundation/Foundation.h>
  18 +
  19 +@class OCMLocation;
  20 +@class OCMRecorder;
  21 +@class OCMStubRecorder;
  22 +@class OCMockObject;
  23 +
  24 +
  25 +@interface OCMMacroState : NSObject
  26 +{
  27 + OCMRecorder *recorder;
  28 +}
  29 +
  30 ++ (void)beginStubMacro;
  31 ++ (OCMStubRecorder *)endStubMacro;
  32 +
  33 ++ (void)beginExpectMacro;
  34 ++ (OCMStubRecorder *)endExpectMacro;
  35 +
  36 ++ (void)beginVerifyMacroAtLocation:(OCMLocation *)aLocation;
  37 ++ (void)endVerifyMacro;
  38 +
  39 ++ (OCMMacroState *)globalState;
  40 +
  41 +- (OCMRecorder *)recorder;
  42 +
  43 +- (void)switchToClassMethod;
  44 +
  45 +@end
  1 +/*
  2 + * Copyright (c) 2014 Erik Doernenburg and contributors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License"); you may
  5 + * not use these files except in compliance with the License. You may obtain
  6 + * a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12 + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13 + * License for the specific language governing permissions and limitations
  14 + * under the License.
  15 + */
  16 +
  17 +#import <Foundation/Foundation.h>
  18 +
  19 +@class OCMockObject;
  20 +@class OCMInvocationMatcher;
  21 +
  22 +
  23 +@interface OCMRecorder : NSProxy
  24 +{
  25 + OCMockObject *mockObject;
  26 + OCMInvocationMatcher *invocationMatcher;
  27 +}
  28 +
  29 +- (instancetype)init;
  30 +- (instancetype)initWithMockObject:(OCMockObject *)aMockObject;
  31 +
  32 +- (void)setMockObject:(OCMockObject *)aMockObject;
  33 +
  34 +- (OCMInvocationMatcher *)invocationMatcher;
  35 +
  36 +- (id)classMethod;
  37 +- (id)ignoringNonObjectArgs;
  38 +
  39 +@end
  1 +/*
  2 + * Copyright (c) 2004-2014 Erik Doernenburg and contributors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License"); you may
  5 + * not use these files except in compliance with the License. You may obtain
  6 + * a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12 + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13 + * License for the specific language governing permissions and limitations
  14 + * under the License.
  15 + */
  16 +
  17 +#import "OCMRecorder.h"
  18 +
  19 +
  20 +@interface OCMStubRecorder : OCMRecorder
  21 +
  22 +- (id)andReturn:(id)anObject;
  23 +- (id)andReturnValue:(NSValue *)aValue;
  24 +- (id)andThrow:(NSException *)anException;
  25 +- (id)andPost:(NSNotification *)aNotification;
  26 +- (id)andCall:(SEL)selector onObject:(id)anObject;
  27 +- (id)andDo:(void (^)(NSInvocation *invocation))block;
  28 +- (id)andForwardToRealObject;
  29 +
  30 +@end
  31 +
  32 +
  33 +@interface OCMStubRecorder (Properties)
  34 +
  35 +#define andReturn(aValue) _andReturn(({ __typeof__(aValue) _v = (aValue); [NSValue value:&_v withObjCType:@encode(__typeof__(_v))]; }))
  36 +@property (nonatomic, readonly) OCMStubRecorder *(^ _andReturn)(NSValue *);
  37 +
  38 +#define andThrow(anException) _andThrow(anException)
  39 +@property (nonatomic, readonly) OCMStubRecorder *(^ _andThrow)(NSException *);
  40 +
  41 +#define andPost(aNotification) _andPost(aNotification)
  42 +@property (nonatomic, readonly) OCMStubRecorder *(^ _andPost)(NSNotification *);
  43 +
  44 +#define andCall(anObject, aSelector) _andCall(anObject, aSelector)
  45 +@property (nonatomic, readonly) OCMStubRecorder *(^ _andCall)(id, SEL);
  46 +
  47 +#define andDo(aBlock) _andDo(aBlock)
  48 +@property (nonatomic, readonly) OCMStubRecorder *(^ _andDo)(void (^)(NSInvocation *));
  49 +
  50 +#define andForwardToRealObject() _andForwardToRealObject()
  51 +@property (nonatomic, readonly) OCMStubRecorder *(^ _andForwardToRealObject)(void);
  52 +
  53 +@end
  54 +
  55 +
  56 +
  1 +/*
  2 + * Copyright (c) 2004-2014 Erik Doernenburg and contributors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License"); you may
  5 + * not use these files except in compliance with the License. You may obtain
  6 + * a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12 + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13 + * License for the specific language governing permissions and limitations
  14 + * under the License.
  15 + */
  16 +
  17 +//#import <OCMock/OCMockObject.h>
  18 +//#import <OCMock/OCMRecorder.h>
  19 +//#import <OCMock/OCMStubRecorder.h>
  20 +//#import <OCMock/OCMConstraint.h>
  21 +//#import <OCMock/OCMArg.h>
  22 +//#import <OCMock/OCMLocation.h>
  23 +//#import <OCMock/OCMMacroState.h>
  24 +//#import <OCMock/NSNotificationCenter+OCMAdditions.h>
  25 +#import "OCMockObject.h"
  26 +#import "OCMRecorder.h"
  27 +#import "OCMStubRecorder.h"
  28 +#import "OCMConstraint.h"
  29 +#import "OCMArg.h"
  30 +#import "OCMLocation.h"
  31 +#import "OCMMacroState.h"
  32 +#import "NSNotificationCenter+OCMAdditions.h"
  33 +
  34 +
  35 +#define OCMClassMock(cls) [OCMockObject niceMockForClass:cls]
  36 +
  37 +#define OCMStrictClassMock(cls) [OCMockObject mockForClass:cls]
  38 +
  39 +#define OCMProtocolMock(protocol) [OCMockObject niceMockForProtocol:protocol]
  40 +
  41 +#define OCMStrictProtocolMock(protocol) [OCMockObject mockForProtocol:protocol]
  42 +
  43 +#define OCMPartialMock(obj) [OCMockObject partialMockForObject:obj]
  44 +
  45 +#define OCMObserverMock() [OCMockObject observerMock]
  46 +
  47 +
  48 +#define OCMStub(invocation) \
  49 +({ \
  50 + _OCMSilenceWarnings( \
  51 + [OCMMacroState beginStubMacro]; \
  52 + invocation; \
  53 + [OCMMacroState endStubMacro]; \
  54 + ); \
  55 +})
  56 +
  57 +#define OCMExpect(invocation) \
  58 +({ \
  59 + _OCMSilenceWarnings( \
  60 + [OCMMacroState beginExpectMacro]; \
  61 + invocation; \
  62 + [OCMMacroState endExpectMacro]; \
  63 + ); \
  64 +})
  65 +
  66 +#define ClassMethod(invocation) \
  67 + _OCMSilenceWarnings( \
  68 + [[OCMMacroState globalState] switchToClassMethod]; \
  69 + invocation; \
  70 + );
  71 +
  72 +
  73 +#define OCMVerifyAll(mock) [mock verifyAtLocation:OCMMakeLocation(self, __FILE__, __LINE__)]
  74 +
  75 +#define OCMVerifyAllWithDelay(mock, delay) [mock verifyWithDelay:delay atLocation:OCMMakeLocation(self, __FILE__, __LINE__)]
  76 +
  77 +#define OCMVerify(invocation) \
  78 +({ \
  79 + _OCMSilenceWarnings( \
  80 + [OCMMacroState beginVerifyMacroAtLocation:OCMMakeLocation(self, __FILE__, __LINE__)]; \
  81 + invocation; \
  82 + [OCMMacroState endVerifyMacro]; \
  83 + ); \
  84 +})
  85 +
  86 +#define _OCMSilenceWarnings(macro) \
  87 +({ \
  88 + _Pragma("clang diagnostic push") \
  89 + _Pragma("clang diagnostic ignored \"-Wunused-value\"") \
  90 + macro \
  91 + _Pragma("clang diagnostic pop") \
  92 +})
  1 +/*
  2 + * Copyright (c) 2004-2014 Erik Doernenburg and contributors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License"); you may
  5 + * not use these files except in compliance with the License. You may obtain
  6 + * a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12 + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13 + * License for the specific language governing permissions and limitations
  14 + * under the License.
  15 + */
  16 +
  17 +#import <Foundation/Foundation.h>
  18 +
  19 +@class OCMLocation;
  20 +@class OCMInvocationStub;
  21 +@class OCMStubRecorder;
  22 +@class OCMInvocationMatcher;
  23 +@class OCMInvocationExpectation;
  24 +
  25 +
  26 +@interface OCMockObject : NSProxy
  27 +{
  28 + BOOL isNice;
  29 + BOOL expectationOrderMatters;
  30 + NSMutableArray *stubs;
  31 + NSMutableArray *expectations;
  32 + NSMutableArray *exceptions;
  33 + NSMutableArray *invocations;
  34 +}
  35 +
  36 ++ (id)mockForClass:(Class)aClass;
  37 ++ (id)mockForProtocol:(Protocol *)aProtocol;
  38 ++ (id)partialMockForObject:(NSObject *)anObject;
  39 +
  40 ++ (id)niceMockForClass:(Class)aClass;
  41 ++ (id)niceMockForProtocol:(Protocol *)aProtocol;
  42 +
  43 ++ (id)observerMock;
  44 +
  45 +- (instancetype)init;
  46 +
  47 +- (void)setExpectationOrderMatters:(BOOL)flag;
  48 +
  49 +- (id)stub;
  50 +- (id)expect;
  51 +- (id)reject;
  52 +
  53 +- (id)verify;
  54 +- (id)verifyAtLocation:(OCMLocation *)location;
  55 +
  56 +- (void)verifyWithDelay:(NSTimeInterval)delay;
  57 +- (void)verifyWithDelay:(NSTimeInterval)delay atLocation:(OCMLocation *)location;
  58 +
  59 +- (void)stopMocking;
  60 +
  61 +// internal use only
  62 +
  63 +- (void)addStub:(OCMInvocationStub *)aStub;
  64 +- (void)addExpectation:(OCMInvocationExpectation *)anExpectation;
  65 +
  66 +- (BOOL)handleInvocation:(NSInvocation *)anInvocation;
  67 +- (void)handleUnRecordedInvocation:(NSInvocation *)anInvocation;
  68 +- (BOOL)handleSelector:(SEL)sel;
  69 +
  70 +- (void)verifyInvocation:(OCMInvocationMatcher *)matcher;
  71 +- (void)verifyInvocation:(OCMInvocationMatcher *)matcher atLocation:(OCMLocation *)location;
  72 +
  73 +@end
  74 +
No preview for this file type
1 -<?xml version="1.0" encoding="UTF-8"?>  
2 -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">  
3 -<plist version="1.0">  
4 -<dict>  
5 - <key>CFBundleDevelopmentRegion</key>  
6 - <string>en</string>  
7 - <key>CFBundleExecutable</key>  
8 - <string>$(EXECUTABLE_NAME)</string>  
9 - <key>CFBundleIdentifier</key>  
10 - <string>cn.yoho.$(PRODUCT_NAME:rfc1034identifier)</string>  
11 - <key>CFBundleInfoDictionaryVersion</key>  
12 - <string>6.0</string>  
13 - <key>CFBundleName</key>  
14 - <string>$(PRODUCT_NAME)</string>  
15 - <key>CFBundlePackageType</key>  
16 - <string>FMWK</string>  
17 - <key>CFBundleShortVersionString</key>  
18 - <string>1.0</string>  
19 - <key>CFBundleSignature</key>  
20 - <string>????</string>  
21 - <key>CFBundleVersion</key>  
22 - <string>$(CURRENT_PROJECT_VERSION)</string>  
23 - <key>NSPrincipalClass</key>  
24 - <string></string>  
25 -</dict>  
26 -</plist>  
1 -//  
2 -// YHAnalytics.h  
3 -// YHAnalytics  
4 -//  
5 -// Created by 王钱钧 on 15/2/6.  
6 -// Copyright (c) 2015年 YOHO. All rights reserved.  
7 -//  
8 -  
9 -#import <UIKit/UIKit.h>  
10 -  
11 -//! Project version number for YHAnalytics.  
12 -FOUNDATION_EXPORT double YHAnalyticsVersionNumber;  
13 -  
14 -//! Project version string for YHAnalytics.  
15 -FOUNDATION_EXPORT const unsigned char YHAnalyticsVersionString[];  
16 -  
17 -// In this header, you should import all the public headers of your framework using statements like #import <YHAnalytics/PublicHeader.h>  
18 -  
19 -  
20 -#import <YHAnalytics/YH_Analytics.h>  
21 -#import <YHAnalytics/YHError.h>  
1 -<?xml version="1.0" encoding="UTF-8"?>  
2 -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">  
3 -<plist version="1.0">  
4 -<dict>  
5 - <key>CFBundleDevelopmentRegion</key>  
6 - <string>en</string>  
7 - <key>CFBundleExecutable</key>  
8 - <string>$(EXECUTABLE_NAME)</string>  
9 - <key>CFBundleIdentifier</key>  
10 - <string>cn.yoho.$(PRODUCT_NAME:rfc1034identifier)</string>  
11 - <key>CFBundleInfoDictionaryVersion</key>  
12 - <string>6.0</string>  
13 - <key>CFBundleName</key>  
14 - <string>$(PRODUCT_NAME)</string>  
15 - <key>CFBundlePackageType</key>  
16 - <string>BNDL</string>  
17 - <key>CFBundleShortVersionString</key>  
18 - <string>1.0</string>  
19 - <key>CFBundleSignature</key>  
20 - <string>????</string>  
21 - <key>CFBundleVersion</key>  
22 - <string>1</string>  
23 -</dict>  
24 -</plist>  
1 -//  
2 -// YHAnalyticsTests.m  
3 -// YHAnalyticsTests  
4 -//  
5 -// Created by 王钱钧 on 15/2/6.  
6 -// Copyright (c) 2015年 YOHO. All rights reserved.  
7 -//  
8 -  
9 -#import <UIKit/UIKit.h>  
10 -#import <XCTest/XCTest.h>  
11 -  
12 -@interface YHAnalyticsTests : XCTestCase  
13 -  
14 -@end  
15 -  
16 -@implementation YHAnalyticsTests  
17 -  
18 -- (void)setUp {  
19 - [super setUp];  
20 - // Put setup code here. This method is called before the invocation of each test method in the class.  
21 -}  
22 -  
23 -- (void)tearDown {  
24 - // Put teardown code here. This method is called after the invocation of each test method in the class.  
25 - [super tearDown];  
26 -}  
27 -  
28 -- (void)testExample {  
29 - // This is an example of a functional test case.  
30 - XCTAssert(YES, @"Pass");  
31 -}  
32 -  
33 -- (void)testPerformanceExample {  
34 - // This is an example of a performance test case.  
35 - [self measureBlock:^{  
36 - // Put the code you want to measure the time of here.  
37 - }];  
38 -}  
39 -  
40 -@end  
@@ -15,6 +15,7 @@ @@ -15,6 +15,7 @@
15 194EDC841A7F52D100421E6C /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 194EDC821A7F52D100421E6C /* LaunchScreen.xib */; }; 15 194EDC841A7F52D100421E6C /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 194EDC821A7F52D100421E6C /* LaunchScreen.xib */; };
16 194EDC901A7F52D100421E6C /* YH_AnalyticsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 194EDC8F1A7F52D100421E6C /* YH_AnalyticsTests.m */; }; 16 194EDC901A7F52D100421E6C /* YH_AnalyticsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 194EDC8F1A7F52D100421E6C /* YH_AnalyticsTests.m */; };
17 194EDC9C1A7F555800421E6C /* YH_Analytics.m in Sources */ = {isa = PBXBuildFile; fileRef = 194EDC9B1A7F555800421E6C /* YH_Analytics.m */; }; 17 194EDC9C1A7F555800421E6C /* YH_Analytics.m in Sources */ = {isa = PBXBuildFile; fileRef = 194EDC9B1A7F555800421E6C /* YH_Analytics.m */; };
  18 + CABC32831AD7CEB8002A4260 /* libOCMock.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CABC32821AD7CEB8002A4260 /* libOCMock.a */; };
18 E74D45B21ABA7C6300EFE12E /* AFHTTPRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = E74D458E1ABA7C6300EFE12E /* AFHTTPRequestOperation.m */; }; 19 E74D45B21ABA7C6300EFE12E /* AFHTTPRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = E74D458E1ABA7C6300EFE12E /* AFHTTPRequestOperation.m */; };
19 E74D45B31ABA7C6300EFE12E /* AFHTTPRequestOperationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E74D45901ABA7C6300EFE12E /* AFHTTPRequestOperationManager.m */; }; 20 E74D45B31ABA7C6300EFE12E /* AFHTTPRequestOperationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E74D45901ABA7C6300EFE12E /* AFHTTPRequestOperationManager.m */; };
20 E74D45B41ABA7C6300EFE12E /* AFHTTPSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E74D45921ABA7C6300EFE12E /* AFHTTPSessionManager.m */; }; 21 E74D45B41ABA7C6300EFE12E /* AFHTTPSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E74D45921ABA7C6300EFE12E /* AFHTTPSessionManager.m */; };
@@ -54,7 +55,6 @@ @@ -54,7 +55,6 @@
54 E7B8DE571A8343D200102CC4 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7B8DE561A8343D200102CC4 /* CoreLocation.framework */; }; 55 E7B8DE571A8343D200102CC4 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7B8DE561A8343D200102CC4 /* CoreLocation.framework */; };
55 E7B8DE5E1A836F8700102CC4 /* CoreTelephony.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7B8DE5D1A836F8700102CC4 /* CoreTelephony.framework */; }; 56 E7B8DE5E1A836F8700102CC4 /* CoreTelephony.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7B8DE5D1A836F8700102CC4 /* CoreTelephony.framework */; };
56 E7B8DE621A838EC200102CC4 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7B8DE611A838EC200102CC4 /* AdSupport.framework */; }; 57 E7B8DE621A838EC200102CC4 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7B8DE611A838EC200102CC4 /* AdSupport.framework */; };
57 - E7E311C11A84C6DF004DB7DF /* YHAnalyticsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7E311C01A84C6DF004DB7DF /* YHAnalyticsTests.m */; };  
58 /* End PBXBuildFile section */ 58 /* End PBXBuildFile section */
59 59
60 /* Begin PBXContainerItemProxy section */ 60 /* Begin PBXContainerItemProxy section */
@@ -65,13 +65,6 @@ @@ -65,13 +65,6 @@
65 remoteGlobalIDString = 194EDC6F1A7F52D100421E6C; 65 remoteGlobalIDString = 194EDC6F1A7F52D100421E6C;
66 remoteInfo = YH_Analytics; 66 remoteInfo = YH_Analytics;
67 }; 67 };
68 - E7E311BB1A84C6DF004DB7DF /* PBXContainerItemProxy */ = {  
69 - isa = PBXContainerItemProxy;  
70 - containerPortal = 194EDC681A7F52D100421E6C /* Project object */;  
71 - proxyType = 1;  
72 - remoteGlobalIDString = 194EDC6F1A7F52D100421E6C;  
73 - remoteInfo = YH_Analytics;  
74 - };  
75 /* End PBXContainerItemProxy section */ 68 /* End PBXContainerItemProxy section */
76 69
77 /* Begin PBXCopyFilesBuildPhase section */ 70 /* Begin PBXCopyFilesBuildPhase section */
@@ -103,6 +96,16 @@ @@ -103,6 +96,16 @@
103 194EDC8F1A7F52D100421E6C /* YH_AnalyticsTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YH_AnalyticsTests.m; sourceTree = "<group>"; }; 96 194EDC8F1A7F52D100421E6C /* YH_AnalyticsTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YH_AnalyticsTests.m; sourceTree = "<group>"; };
104 194EDC9A1A7F555800421E6C /* YH_Analytics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YH_Analytics.h; sourceTree = "<group>"; }; 97 194EDC9A1A7F555800421E6C /* YH_Analytics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YH_Analytics.h; sourceTree = "<group>"; };
105 194EDC9B1A7F555800421E6C /* YH_Analytics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YH_Analytics.m; sourceTree = "<group>"; }; 98 194EDC9B1A7F555800421E6C /* YH_Analytics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YH_Analytics.m; sourceTree = "<group>"; };
  99 + CABC32791AD7CE40002A4260 /* NSNotificationCenter+OCMAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSNotificationCenter+OCMAdditions.h"; sourceTree = "<group>"; };
  100 + CABC327A1AD7CE40002A4260 /* OCMArg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMArg.h; sourceTree = "<group>"; };
  101 + CABC327B1AD7CE40002A4260 /* OCMConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMConstraint.h; sourceTree = "<group>"; };
  102 + CABC327C1AD7CE40002A4260 /* OCMLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMLocation.h; sourceTree = "<group>"; };
  103 + CABC327D1AD7CE40002A4260 /* OCMMacroState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMMacroState.h; sourceTree = "<group>"; };
  104 + CABC327E1AD7CE40002A4260 /* OCMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMock.h; sourceTree = "<group>"; };
  105 + CABC327F1AD7CE40002A4260 /* OCMockObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMockObject.h; sourceTree = "<group>"; };
  106 + CABC32801AD7CE40002A4260 /* OCMRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMRecorder.h; sourceTree = "<group>"; };
  107 + CABC32811AD7CE40002A4260 /* OCMStubRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMStubRecorder.h; sourceTree = "<group>"; };
  108 + CABC32821AD7CEB8002A4260 /* libOCMock.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libOCMock.a; sourceTree = "<group>"; };
106 E74D458D1ABA7C6300EFE12E /* AFHTTPRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFHTTPRequestOperation.h; sourceTree = "<group>"; }; 109 E74D458D1ABA7C6300EFE12E /* AFHTTPRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFHTTPRequestOperation.h; sourceTree = "<group>"; };
107 E74D458E1ABA7C6300EFE12E /* AFHTTPRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFHTTPRequestOperation.m; sourceTree = "<group>"; }; 110 E74D458E1ABA7C6300EFE12E /* AFHTTPRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFHTTPRequestOperation.m; sourceTree = "<group>"; };
108 E74D458F1ABA7C6300EFE12E /* AFHTTPRequestOperationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFHTTPRequestOperationManager.h; sourceTree = "<group>"; }; 111 E74D458F1ABA7C6300EFE12E /* AFHTTPRequestOperationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFHTTPRequestOperationManager.h; sourceTree = "<group>"; };
@@ -180,11 +183,6 @@ @@ -180,11 +183,6 @@
180 E7B8DE5A1A83551300102CC4 /* YH_Analytics.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = YH_Analytics.entitlements; sourceTree = "<group>"; }; 183 E7B8DE5A1A83551300102CC4 /* YH_Analytics.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = YH_Analytics.entitlements; sourceTree = "<group>"; };
181 E7B8DE5D1A836F8700102CC4 /* CoreTelephony.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreTelephony.framework; path = System/Library/Frameworks/CoreTelephony.framework; sourceTree = SDKROOT; }; 184 E7B8DE5D1A836F8700102CC4 /* CoreTelephony.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreTelephony.framework; path = System/Library/Frameworks/CoreTelephony.framework; sourceTree = SDKROOT; };
182 E7B8DE611A838EC200102CC4 /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; }; 185 E7B8DE611A838EC200102CC4 /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; };
183 - E7E311B01A84C6DF004DB7DF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };  
184 - E7E311B11A84C6DF004DB7DF /* YHAnalytics.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YHAnalytics.h; sourceTree = "<group>"; };  
185 - E7E311B71A84C6DF004DB7DF /* YHAnalyticsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = YHAnalyticsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };  
186 - E7E311BF1A84C6DF004DB7DF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };  
187 - E7E311C01A84C6DF004DB7DF /* YHAnalyticsTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YHAnalyticsTests.m; sourceTree = "<group>"; };  
188 /* End PBXFileReference section */ 186 /* End PBXFileReference section */
189 187
190 /* Begin PBXFrameworksBuildPhase section */ 188 /* Begin PBXFrameworksBuildPhase section */
@@ -203,13 +201,7 @@ @@ -203,13 +201,7 @@
203 isa = PBXFrameworksBuildPhase; 201 isa = PBXFrameworksBuildPhase;
204 buildActionMask = 2147483647; 202 buildActionMask = 2147483647;
205 files = ( 203 files = (
206 - );  
207 - runOnlyForDeploymentPostprocessing = 0;  
208 - };  
209 - E7E311B41A84C6DF004DB7DF /* Frameworks */ = {  
210 - isa = PBXFrameworksBuildPhase;  
211 - buildActionMask = 2147483647;  
212 - files = ( 204 + CABC32831AD7CEB8002A4260 /* libOCMock.a in Frameworks */,
213 ); 205 );
214 runOnlyForDeploymentPostprocessing = 0; 206 runOnlyForDeploymentPostprocessing = 0;
215 }; 207 };
@@ -219,11 +211,10 @@ @@ -219,11 +211,10 @@
219 194EDC671A7F52D100421E6C = { 211 194EDC671A7F52D100421E6C = {
220 isa = PBXGroup; 212 isa = PBXGroup;
221 children = ( 213 children = (
  214 + CABC32771AD7CDFD002A4260 /* TestDependence */,
222 E7B8DE631A839C7700102CC4 /* Framework */, 215 E7B8DE631A839C7700102CC4 /* Framework */,
223 194EDC721A7F52D100421E6C /* YH_Analytics */, 216 194EDC721A7F52D100421E6C /* YH_Analytics */,
224 194EDC8C1A7F52D100421E6C /* YH_AnalyticsTests */, 217 194EDC8C1A7F52D100421E6C /* YH_AnalyticsTests */,
225 - E7E311AE1A84C6DF004DB7DF /* YHAnalytics.Framework */,  
226 - E7E311BD1A84C6DF004DB7DF /* YHAnalyticsTests */,  
227 194EDC711A7F52D100421E6C /* Products */, 218 194EDC711A7F52D100421E6C /* Products */,
228 ); 219 );
229 sourceTree = "<group>"; 220 sourceTree = "<group>";
@@ -233,7 +224,6 @@ @@ -233,7 +224,6 @@
233 children = ( 224 children = (
234 194EDC701A7F52D100421E6C /* YH_Analytics.app */, 225 194EDC701A7F52D100421E6C /* YH_Analytics.app */,
235 194EDC891A7F52D100421E6C /* YH_AnalyticsTests.xctest */, 226 194EDC891A7F52D100421E6C /* YH_AnalyticsTests.xctest */,
236 - E7E311B71A84C6DF004DB7DF /* YHAnalyticsTests.xctest */,  
237 ); 227 );
238 name = Products; 228 name = Products;
239 sourceTree = "<group>"; 229 sourceTree = "<group>";
@@ -298,6 +288,31 @@ @@ -298,6 +288,31 @@
298 path = YH_Analytics; 288 path = YH_Analytics;
299 sourceTree = "<group>"; 289 sourceTree = "<group>";
300 }; 290 };
  291 + CABC32771AD7CDFD002A4260 /* TestDependence */ = {
  292 + isa = PBXGroup;
  293 + children = (
  294 + CABC32781AD7CE40002A4260 /* OCMock */,
  295 + );
  296 + name = TestDependence;
  297 + sourceTree = "<group>";
  298 + };
  299 + CABC32781AD7CE40002A4260 /* OCMock */ = {
  300 + isa = PBXGroup;
  301 + children = (
  302 + CABC32821AD7CEB8002A4260 /* libOCMock.a */,
  303 + CABC32791AD7CE40002A4260 /* NSNotificationCenter+OCMAdditions.h */,
  304 + CABC327A1AD7CE40002A4260 /* OCMArg.h */,
  305 + CABC327B1AD7CE40002A4260 /* OCMConstraint.h */,
  306 + CABC327C1AD7CE40002A4260 /* OCMLocation.h */,
  307 + CABC327D1AD7CE40002A4260 /* OCMMacroState.h */,
  308 + CABC327E1AD7CE40002A4260 /* OCMock.h */,
  309 + CABC327F1AD7CE40002A4260 /* OCMockObject.h */,
  310 + CABC32801AD7CE40002A4260 /* OCMRecorder.h */,
  311 + CABC32811AD7CE40002A4260 /* OCMStubRecorder.h */,
  312 + );
  313 + path = OCMock;
  314 + sourceTree = "<group>";
  315 + };
301 E74D458C1ABA7C6300EFE12E /* AFNetworking */ = { 316 E74D458C1ABA7C6300EFE12E /* AFNetworking */ = {
302 isa = PBXGroup; 317 isa = PBXGroup;
303 children = ( 318 children = (
@@ -437,41 +452,6 @@ @@ -437,41 +452,6 @@
437 name = Framework; 452 name = Framework;
438 sourceTree = "<group>"; 453 sourceTree = "<group>";
439 }; 454 };
440 - E7E311AE1A84C6DF004DB7DF /* YHAnalytics.Framework */ = {  
441 - isa = PBXGroup;  
442 - children = (  
443 - E7E311B11A84C6DF004DB7DF /* YHAnalytics.h */,  
444 - E7E311AF1A84C6DF004DB7DF /* Supporting Files */,  
445 - );  
446 - name = YHAnalytics.Framework;  
447 - path = YHAnalytics;  
448 - sourceTree = "<group>";  
449 - };  
450 - E7E311AF1A84C6DF004DB7DF /* Supporting Files */ = {  
451 - isa = PBXGroup;  
452 - children = (  
453 - E7E311B01A84C6DF004DB7DF /* Info.plist */,  
454 - );  
455 - name = "Supporting Files";  
456 - sourceTree = "<group>";  
457 - };  
458 - E7E311BD1A84C6DF004DB7DF /* YHAnalyticsTests */ = {  
459 - isa = PBXGroup;  
460 - children = (  
461 - E7E311C01A84C6DF004DB7DF /* YHAnalyticsTests.m */,  
462 - E7E311BE1A84C6DF004DB7DF /* Supporting Files */,  
463 - );  
464 - path = YHAnalyticsTests;  
465 - sourceTree = "<group>";  
466 - };  
467 - E7E311BE1A84C6DF004DB7DF /* Supporting Files */ = {  
468 - isa = PBXGroup;  
469 - children = (  
470 - E7E311BF1A84C6DF004DB7DF /* Info.plist */,  
471 - );  
472 - name = "Supporting Files";  
473 - sourceTree = "<group>";  
474 - };  
475 /* End PBXGroup section */ 455 /* End PBXGroup section */
476 456
477 /* Begin PBXNativeTarget section */ 457 /* Begin PBXNativeTarget section */
@@ -511,24 +491,6 @@ @@ -511,24 +491,6 @@
511 productReference = 194EDC891A7F52D100421E6C /* YH_AnalyticsTests.xctest */; 491 productReference = 194EDC891A7F52D100421E6C /* YH_AnalyticsTests.xctest */;
512 productType = "com.apple.product-type.bundle.unit-test"; 492 productType = "com.apple.product-type.bundle.unit-test";
513 }; 493 };
514 - E7E311B61A84C6DF004DB7DF /* YHAnalyticsTests */ = {  
515 - isa = PBXNativeTarget;  
516 - buildConfigurationList = E7E311CC1A84C6DF004DB7DF /* Build configuration list for PBXNativeTarget "YHAnalyticsTests" */;  
517 - buildPhases = (  
518 - E7E311B31A84C6DF004DB7DF /* Sources */,  
519 - E7E311B41A84C6DF004DB7DF /* Frameworks */,  
520 - E7E311B51A84C6DF004DB7DF /* Resources */,  
521 - );  
522 - buildRules = (  
523 - );  
524 - dependencies = (  
525 - E7E311BC1A84C6DF004DB7DF /* PBXTargetDependency */,  
526 - );  
527 - name = YHAnalyticsTests;  
528 - productName = YHAnalyticsTests;  
529 - productReference = E7E311B71A84C6DF004DB7DF /* YHAnalyticsTests.xctest */;  
530 - productType = "com.apple.product-type.bundle.unit-test";  
531 - };  
532 /* End PBXNativeTarget section */ 494 /* End PBXNativeTarget section */
533 495
534 /* Begin PBXProject section */ 496 /* Begin PBXProject section */
@@ -554,10 +516,6 @@ @@ -554,10 +516,6 @@
554 CreatedOnToolsVersion = 6.1.1; 516 CreatedOnToolsVersion = 6.1.1;
555 TestTargetID = 194EDC6F1A7F52D100421E6C; 517 TestTargetID = 194EDC6F1A7F52D100421E6C;
556 }; 518 };
557 - E7E311B61A84C6DF004DB7DF = {  
558 - CreatedOnToolsVersion = 6.1;  
559 - TestTargetID = 194EDC6F1A7F52D100421E6C;  
560 - };  
561 }; 519 };
562 }; 520 };
563 buildConfigurationList = 194EDC6B1A7F52D100421E6C /* Build configuration list for PBXProject "YH_Analytics" */; 521 buildConfigurationList = 194EDC6B1A7F52D100421E6C /* Build configuration list for PBXProject "YH_Analytics" */;
@@ -575,7 +533,6 @@ @@ -575,7 +533,6 @@
575 targets = ( 533 targets = (
576 194EDC6F1A7F52D100421E6C /* YH_Analytics */, 534 194EDC6F1A7F52D100421E6C /* YH_Analytics */,
577 194EDC881A7F52D100421E6C /* YH_AnalyticsTests */, 535 194EDC881A7F52D100421E6C /* YH_AnalyticsTests */,
578 - E7E311B61A84C6DF004DB7DF /* YHAnalyticsTests */,  
579 ); 536 );
580 }; 537 };
581 /* End PBXProject section */ 538 /* End PBXProject section */
@@ -598,13 +555,6 @@ @@ -598,13 +555,6 @@
598 ); 555 );
599 runOnlyForDeploymentPostprocessing = 0; 556 runOnlyForDeploymentPostprocessing = 0;
600 }; 557 };
601 - E7E311B51A84C6DF004DB7DF /* Resources */ = {  
602 - isa = PBXResourcesBuildPhase;  
603 - buildActionMask = 2147483647;  
604 - files = (  
605 - );  
606 - runOnlyForDeploymentPostprocessing = 0;  
607 - };  
608 /* End PBXResourcesBuildPhase section */ 558 /* End PBXResourcesBuildPhase section */
609 559
610 /* Begin PBXSourcesBuildPhase section */ 560 /* Begin PBXSourcesBuildPhase section */
@@ -662,14 +612,6 @@ @@ -662,14 +612,6 @@
662 ); 612 );
663 runOnlyForDeploymentPostprocessing = 0; 613 runOnlyForDeploymentPostprocessing = 0;
664 }; 614 };
665 - E7E311B31A84C6DF004DB7DF /* Sources */ = {  
666 - isa = PBXSourcesBuildPhase;  
667 - buildActionMask = 2147483647;  
668 - files = (  
669 - E7E311C11A84C6DF004DB7DF /* YHAnalyticsTests.m in Sources */,  
670 - );  
671 - runOnlyForDeploymentPostprocessing = 0;  
672 - };  
673 /* End PBXSourcesBuildPhase section */ 615 /* End PBXSourcesBuildPhase section */
674 616
675 /* Begin PBXTargetDependency section */ 617 /* Begin PBXTargetDependency section */
@@ -678,11 +620,6 @@ @@ -678,11 +620,6 @@
678 target = 194EDC6F1A7F52D100421E6C /* YH_Analytics */; 620 target = 194EDC6F1A7F52D100421E6C /* YH_Analytics */;
679 targetProxy = 194EDC8A1A7F52D100421E6C /* PBXContainerItemProxy */; 621 targetProxy = 194EDC8A1A7F52D100421E6C /* PBXContainerItemProxy */;
680 }; 622 };
681 - E7E311BC1A84C6DF004DB7DF /* PBXTargetDependency */ = {  
682 - isa = PBXTargetDependency;  
683 - target = 194EDC6F1A7F52D100421E6C /* YH_Analytics */;  
684 - targetProxy = E7E311BB1A84C6DF004DB7DF /* PBXContainerItemProxy */;  
685 - };  
686 /* End PBXTargetDependency section */ 623 /* End PBXTargetDependency section */
687 624
688 /* Begin PBXVariantGroup section */ 625 /* Begin PBXVariantGroup section */
@@ -822,8 +759,25 @@ @@ -822,8 +759,25 @@
822 "DEBUG=1", 759 "DEBUG=1",
823 "$(inherited)", 760 "$(inherited)",
824 ); 761 );
  762 + HEADER_SEARCH_PATHS = (
  763 + "$(inherited)",
  764 + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
  765 + "$(PROJECT_DIR)/OCMock",
  766 + );
825 INFOPLIST_FILE = YH_AnalyticsTests/Info.plist; 767 INFOPLIST_FILE = YH_AnalyticsTests/Info.plist;
826 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 768 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
  769 + LIBRARY_SEARCH_PATHS = (
  770 + "$(inherited)",
  771 + /Users/bearKing/Desktop/UnitTest/OCMock,
  772 + 3.1.2/iOS,
  773 + "$(PROJECT_DIR)/OCMock",
  774 + );
  775 + OTHER_LDFLAGS = (
  776 + "$(inherited)",
  777 + "-framework",
  778 + XCTest,
  779 + "-ObjC",
  780 + );
827 PRODUCT_NAME = "$(TARGET_NAME)"; 781 PRODUCT_NAME = "$(TARGET_NAME)";
828 TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YH_Analytics.app/YH_Analytics"; 782 TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YH_Analytics.app/YH_Analytics";
829 }; 783 };
@@ -837,40 +791,25 @@ @@ -837,40 +791,25 @@
837 "$(SDKROOT)/Developer/Library/Frameworks", 791 "$(SDKROOT)/Developer/Library/Frameworks",
838 "$(inherited)", 792 "$(inherited)",
839 ); 793 );
840 - INFOPLIST_FILE = YH_AnalyticsTests/Info.plist;  
841 - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";  
842 - PRODUCT_NAME = "$(TARGET_NAME)";  
843 - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YH_Analytics.app/YH_Analytics";  
844 - };  
845 - name = Release;  
846 - };  
847 - E7E311C81A84C6DF004DB7DF /* Debug */ = {  
848 - isa = XCBuildConfiguration;  
849 - buildSettings = {  
850 - FRAMEWORK_SEARCH_PATHS = (  
851 - "$(SDKROOT)/Developer/Library/Frameworks", 794 + HEADER_SEARCH_PATHS = (
852 "$(inherited)", 795 "$(inherited)",
  796 + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
  797 + "$(PROJECT_DIR)/OCMock",
853 ); 798 );
854 - GCC_PREPROCESSOR_DEFINITIONS = (  
855 - "DEBUG=1", 799 + INFOPLIST_FILE = YH_AnalyticsTests/Info.plist;
  800 + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
  801 + LIBRARY_SEARCH_PATHS = (
856 "$(inherited)", 802 "$(inherited)",
  803 + /Users/bearKing/Desktop/UnitTest/OCMock,
  804 + 3.1.2/iOS,
  805 + "$(PROJECT_DIR)/OCMock",
857 ); 806 );
858 - INFOPLIST_FILE = YHAnalyticsTests/Info.plist;  
859 - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";  
860 - PRODUCT_NAME = "$(TARGET_NAME)";  
861 - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YH_Analytics.app/YH_Analytics";  
862 - };  
863 - name = Debug;  
864 - };  
865 - E7E311C91A84C6DF004DB7DF /* Release */ = {  
866 - isa = XCBuildConfiguration;  
867 - buildSettings = {  
868 - FRAMEWORK_SEARCH_PATHS = (  
869 - "$(SDKROOT)/Developer/Library/Frameworks", 807 + OTHER_LDFLAGS = (
870 "$(inherited)", 808 "$(inherited)",
  809 + "-framework",
  810 + XCTest,
  811 + "-ObjC",
871 ); 812 );
872 - INFOPLIST_FILE = YHAnalyticsTests/Info.plist;  
873 - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";  
874 PRODUCT_NAME = "$(TARGET_NAME)"; 813 PRODUCT_NAME = "$(TARGET_NAME)";
875 TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YH_Analytics.app/YH_Analytics"; 814 TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YH_Analytics.app/YH_Analytics";
876 }; 815 };
@@ -906,15 +845,6 @@ @@ -906,15 +845,6 @@
906 defaultConfigurationIsVisible = 0; 845 defaultConfigurationIsVisible = 0;
907 defaultConfigurationName = Release; 846 defaultConfigurationName = Release;
908 }; 847 };
909 - E7E311CC1A84C6DF004DB7DF /* Build configuration list for PBXNativeTarget "YHAnalyticsTests" */ = {  
910 - isa = XCConfigurationList;  
911 - buildConfigurations = (  
912 - E7E311C81A84C6DF004DB7DF /* Debug */,  
913 - E7E311C91A84C6DF004DB7DF /* Release */,  
914 - );  
915 - defaultConfigurationIsVisible = 0;  
916 - defaultConfigurationName = Release;  
917 - };  
918 /* End XCConfigurationList section */ 848 /* End XCConfigurationList section */
919 }; 849 };
920 rootObject = 194EDC681A7F52D100421E6C /* Project object */; 850 rootObject = 194EDC681A7F52D100421E6C /* Project object */;
@@ -143,9 +143,8 @@ static dispatch_queue_t persisitingQueue; @@ -143,9 +143,8 @@ static dispatch_queue_t persisitingQueue;
143 [YHCrashReporter sharedInstance]; 143 [YHCrashReporter sharedInstance];
144 } 144 }
145 145
146 -- (void)registerAppWillEnterForegroundNotification {  
147 -  
148 - 146 +- (void)registerAppWillEnterForegroundNotification
  147 +{
149 // 当程序切换到后台,重置session 和 eventIndex 148 // 当程序切换到后台,重置session 和 eventIndex
150 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resetSession) name:UIApplicationWillEnterForegroundNotification object:nil]; 149 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resetSession) name:UIApplicationWillEnterForegroundNotification object:nil];
151 } 150 }
@@ -154,6 +153,7 @@ static dispatch_queue_t persisitingQueue; @@ -154,6 +153,7 @@ static dispatch_queue_t persisitingQueue;
154 NSLog(@"app will enter foreground !!"); 153 NSLog(@"app will enter foreground !!");
155 self.session = nil; 154 self.session = nil;
156 } 155 }
  156 +
157 - (void)startWithAppId:(NSString *)appId 157 - (void)startWithAppId:(NSString *)appId
158 { 158 {
159 [self registerCrashReporter]; 159 [self registerCrashReporter];
@@ -201,7 +201,6 @@ static dispatch_queue_t persisitingQueue; @@ -201,7 +201,6 @@ static dispatch_queue_t persisitingQueue;
201 // 记录event 201 // 记录event
202 - (void)logEvent:(NSString *)eventId parameters:(NSDictionary *)param 202 - (void)logEvent:(NSString *)eventId parameters:(NSDictionary *)param
203 { 203 {
204 -  
205 if([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined) { 204 if([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined) {
206 [self.locationManager requestAlwaysAuthorization]; 205 [self.locationManager requestAlwaysAuthorization];
207 } 206 }
@@ -222,7 +221,7 @@ static dispatch_queue_t persisitingQueue; @@ -222,7 +221,7 @@ static dispatch_queue_t persisitingQueue;
222 221
223 // 立即发送策略 222 // 立即发送策略
224 if (self.logStrategy == LogStrategyImmedi) { 223 if (self.logStrategy == LogStrategyImmedi) {
225 - [[YHAssemblyAssistant shareInstance]uploadImmedilyWhithEvent:event]; 224 + [[YHAssemblyAssistant shareInstance] uploadImmedilyWhithEvent:event];
226 } else { 225 } else {
227 [[YHAssemblyAssistant shareInstance] saveItemData:event]; 226 [[YHAssemblyAssistant shareInstance] saveItemData:event];
228 } 227 }
@@ -8,8 +8,13 @@ @@ -8,8 +8,13 @@
8 8
9 #import <UIKit/UIKit.h> 9 #import <UIKit/UIKit.h>
10 #import <XCTest/XCTest.h> 10 #import <XCTest/XCTest.h>
  11 +#import "OCMock.h"
  12 +#import "YH_Analytics.h"
11 13
12 -@interface YH_AnalyticsTests : XCTestCase 14 +@interface YH_AnalyticsTests : XCTestCase {
  15 +@private
  16 + id mock;
  17 +}
13 18
14 @end 19 @end
15 20
@@ -18,23 +23,59 @@ @@ -18,23 +23,59 @@
18 - (void)setUp { 23 - (void)setUp {
19 [super setUp]; 24 [super setUp];
20 // Put setup code here. This method is called before the invocation of each test method in the class. 25 // Put setup code here. This method is called before the invocation of each test method in the class.
  26 + NSLog(@"%@ setUp", self.name);
  27 + mock = [OCMockObject mockForClass:[YH_Analytics class]];
  28 + XCTAssertNotNil(mock, @"Cannot create YH_Analytics instance");
21 } 29 }
22 30
23 - (void)tearDown { 31 - (void)tearDown {
24 // Put teardown code here. This method is called after the invocation of each test method in the class. 32 // Put teardown code here. This method is called after the invocation of each test method in the class.
25 [super tearDown]; 33 [super tearDown];
  34 + NSLog(@"%@ tearDown", self.name);
  35 +}
  36 +
  37 +- (void)testStartWithAppIdMethodWithConstraint {
  38 + NSLog(@"%@ start", self.name); // self.name is the name of the test-case method.
  39 +
  40 + [[mock stub] startWithAppId:[OCMArg any]];
  41 + [mock startWithAppId:[OCMArg any]];
  42 +
  43 + NSLog(@"%@ end", self.name);
26 } 44 }
27 45
28 -- (void)testExample {  
29 - // This is an example of a functional test case.  
30 - XCTAssert(YES, @"Pass"); 46 +- (void)testLogEventMethodWithConstraint {
  47 + NSLog(@"%@ start", self.name);
  48 +
  49 + [[mock stub] logEvent:[OCMArg any] parameters:[OCMArg any]];
  50 + [mock logEvent:@"event" parameters:nil];
  51 +
  52 + NSLog(@"%@ end", self.name);
31 } 53 }
32 54
33 -- (void)testPerformanceExample {  
34 - // This is an example of a performance test case.  
35 - [self measureBlock:^{  
36 - // Put the code you want to measure the time of here.  
37 - }]; 55 +- (void)testLogErrorMethodWithConstraint {
  56 + NSLog(@"%@ start", self.name);
  57 +
  58 + [[mock stub] logError:[OCMArg any] parameters:[OCMArg any]];
  59 + [mock logError:@"error" parameters:nil];
  60 +
  61 + NSLog(@"%@ end", self.name);
38 } 62 }
39 63
  64 +- (void)testLogStrategy {
  65 + NSLog(@"%@ start", self.name);
  66 +
  67 + [[mock stub] logStrategy];
  68 + [mock logStrategy];
  69 +
  70 + NSLog(@"%@ end", self.name);
  71 +}
  72 +
  73 +- (void)testSetLogStrategyWithSpecificArgument {
  74 + NSLog(@"%@ start", self.name);
  75 +
  76 + [[mock stub] setLogStrategy:LogStrategyAppLaunch];
  77 + [mock setLogStrategy:LogStrategyAppLaunch];
  78 +
  79 + NSLog(@"%@ end", self.name);
  80 +}
40 @end 81 @end