Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
GMPhobos
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
GMPhobos
Commits
92a32db2
Commit
92a32db2
authored
May 30, 2016
by
翟国钧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加用户的城市信息。更改对应的单元测试
parent
89abe3e5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
GMPhotoTest.m
Example/Tests/GMPhotoTest.m
+6
-4
Phobos.h
Pod/Classes/Phobos.h
+11
-0
No files found.
Example/Tests/GMPhotoTest.m
View file @
92a32db2
...
...
@@ -16,6 +16,7 @@ NSString *const MockAppName = @"gengmei_test";
NSString
*
const
MockChannelId
=
@"AppStore"
;
NSString
*
const
MockEventId
=
@"eventId"
;
NSInteger
const
MockUserId
=
1
;
NSString
*
const
MockCityId
=
@"beijing"
;
@interface
GMPhotoTest
:
XCTestCase
@property
Phobos
*
client
;
...
...
@@ -45,6 +46,7 @@ NSInteger const MockUserId = 1;
*/
-
(
void
)
testClientWithUserId
{
[
_client
setUserId
:
MockUserId
];
[
_client
setCurrentCityId
:
MockCityId
];
[
_client
track
:
MockEventId
];
NSArray
*
array
=
[
_cache
fetchObjectAtDiskWithkey
:
PhobosCacheKey
];
XCTAssertTrue
(
array
.
count
==
1
,
@"array is empty"
);
...
...
@@ -54,12 +56,12 @@ NSInteger const MockUserId = 1;
}
/**
* @brief 测试发送不带参数事件成功
* @brief 测试发送不带参数事件成功
(由之前的实例方法变成类方法)
*
* @since <#version number#>
*/
-
(
void
)
testTrackEventWithoutAttr
{
[
_client
track
:
MockEventId
];
[
Phobos
track
:
MockEventId
];
NSArray
*
array
=
[
_cache
fetchObjectAtDiskWithkey
:
PhobosCacheKey
];
XCTAssertTrue
(
array
.
count
==
1
,
@"array is empty"
);
NSDictionary
*
dict
=
[
array
objectAtIndex
:
0
];
...
...
@@ -74,7 +76,7 @@ NSInteger const MockUserId = 1;
*/
-
(
void
)
testTrackEventWithAttr
{
NSDictionary
*
attr
=
@{
@"attr"
:
@"track_attr"
};
[
_client
track
:
MockEventId
attributes
:
attr
];
[
Phobos
track
:
MockEventId
attributes
:
attr
];
NSArray
*
array
=
[
_cache
fetchObjectAtDiskWithkey
:
PhobosCacheKey
];
XCTAssertTrue
(
array
.
count
==
1
,
@"array is empty"
);
NSDictionary
*
dict
=
[
array
objectAtIndex
:
0
];
...
...
@@ -94,7 +96,7 @@ NSInteger const MockUserId = 1;
// Given
NSDictionary
*
attr
=
@{
@"attr"
:
@"track_attr"
};
// When
[
_client
track
:
MockEventId
attributes
:
attr
sendNow
:
YES
];
[
Phobos
track
:
MockEventId
attributes
:
attr
sendNow
:
YES
];
// Then
NSArray
*
array
=
[
_cache
fetchObjectAtDiskWithkey
:
PhobosCacheKey
];
XCTAssertTrue
(
array
.
count
==
0
,
@"array should be empty"
);
...
...
Pod/Classes/Phobos.h
View file @
92a32db2
...
...
@@ -45,6 +45,17 @@
*/
-
(
void
)
setUserId
:(
NSInteger
)
userId
;
/*!
* @author zhaiguojun, 16-05-30
*
* @brief 用户当前的城市id
*
* @param currentCityId
*
* @since 0.2.5
*/
-
(
void
)
setCurrentCityId
:(
NSString
*
)
currentCityId
;
/**
* @brief 自定义事件,数量统计.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment