Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

Commit cca3c4c

Browse files
committed
Merge branch 'hotfix/57-extended-timelines'
Close #57
2 parents 47d271e + 849b2ca commit cca3c4c

File tree

3 files changed

+44
-3
lines changed

3 files changed

+44
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
All notable changes to this project will be documented in this file, in reverse chronological order by release.
44

5-
## 3.0.3 - TBD
5+
## 3.0.3 - 2018-05-14
66

77
### Added
88

99
- Nothing.
1010

1111
### Changed
1212

13-
- Nothing.
13+
- [#57](https://github.com/zendframework/ZendService_Twitter/pull/57) adds awareness of the `tweet_mode=extended` parameter to each of
14+
the home, mentions, and user timeline API endpoint methods.
1415

1516
### Deprecated
1617

src/Twitter.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,10 @@ public function statusesHomeTimeline(array $options = []) : Response
11141114
case 'max_id':
11151115
$params['max_id'] = $this->validInteger($value);
11161116
break;
1117+
case 'tweet_mode':
1118+
unset($params[$key]);
1119+
$params['tweet_mode'] = 'extended';
1120+
break;
11171121
case 'trim_user':
11181122
if (in_array($value, [true, 'true', 't', 1, '1'])) {
11191123
$value = true;
@@ -1169,6 +1173,10 @@ public function statusesMentionsTimeline(array $options = []) : Response
11691173
case 'max_id':
11701174
$params['max_id'] = $this->validInteger($value);
11711175
break;
1176+
case 'tweet_mode':
1177+
unset($params[$key]);
1178+
$params['tweet_mode'] = 'extended';
1179+
break;
11721180
case 'trim_user':
11731181
if (in_array($value, [true, 'true', 't', 1, '1'])) {
11741182
$value = true;
@@ -1334,6 +1342,10 @@ public function statusesUserTimeline(array $options = []) : Response
13341342
case 'max_id':
13351343
$params['max_id'] = $this->validInteger($value);
13361344
break;
1345+
case 'tweet_mode':
1346+
unset($params[$key]);
1347+
$params['tweet_mode'] = 'extended';
1348+
break;
13371349
case 'trim_user':
13381350
if (in_array($value, [true, 'true', 't', 1, '1'])) {
13391351
$value = true;

test/TwitterTest.php

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ public function testStatusUserTimelineConstructsExpectedGetUriAndOmitsInvalidPar
309309
'since_id' => '10000',
310310
'max_id' => '20000',
311311
'screen_name' => 'twitter',
312+
'tweet_mode' => 'extended',
312313
]
313314
));
314315
$twitter->statuses->userTimeline([
@@ -319,7 +320,8 @@ public function testStatusUserTimelineConstructsExpectedGetUriAndOmitsInvalidPar
319320
'user_id' => '783214',
320321
'since_id' => '10000',
321322
'max_id' => '20000',
322-
'screen_name' => 'twitter'
323+
'screen_name' => 'twitter',
324+
'tweet_mode' => 'extended',
323325
]);
324326
}
325327

@@ -446,6 +448,19 @@ public function testHomeTimelineWithCountReturnsResults()
446448
$this->assertInstanceOf(TwitterResponse::class, $response);
447449
}
448450

451+
public function testHomeTimelineWithExtendedModeReturnsResults()
452+
{
453+
$twitter = new Twitter\Twitter;
454+
$twitter->setHttpClient($this->stubOAuthClient(
455+
'statuses/home_timeline.json',
456+
Http\Request::METHOD_GET,
457+
'statuses.home_timeline.page.json',
458+
['tweet_mode' => 'extended']
459+
));
460+
$response = $twitter->statuses->homeTimeline(['tweet_mode' => 'extended']);
461+
$this->assertInstanceOf(TwitterResponse::class, $response);
462+
}
463+
449464
/**
450465
* TODO: Add verification for ALL optional parameters
451466
*/
@@ -613,6 +628,19 @@ public function testStatusMentionsReturnsResults()
613628
$this->assertInstanceOf(TwitterResponse::class, $response);
614629
}
615630

631+
public function testMentionsTimelineWithExtendedModeReturnsResults()
632+
{
633+
$twitter = new Twitter\Twitter;
634+
$twitter->setHttpClient($this->stubOAuthClient(
635+
'statuses/mentions_timeline.json',
636+
Http\Request::METHOD_GET,
637+
'statuses.mentions_timeline.json',
638+
['tweet_mode' => 'extended']
639+
));
640+
$response = $twitter->statuses->mentionsTimeline(['tweet_mode' => 'extended']);
641+
$this->assertInstanceOf(TwitterResponse::class, $response);
642+
}
643+
616644
/**
617645
* TODO: Add verification for ALL optional parameters
618646
*/

0 commit comments

Comments
 (0)