@@ -66,7 +66,14 @@ public function testTweetImage()
66
66
$ transport = $ this ->createTransport (new MockHttpClient ((function () {
67
67
yield function (string $ method , string $ url , array $ options ) {
68
68
$ this ->assertSame ('POST ' , $ method );
69
- $ this ->assertSame ('https://upload.twitter.com/1.1/media/upload.json?command=INIT&total_bytes=185&media_type=image%252Fgif&media_category=tweet_image ' , $ url );
69
+ $ this ->assertSame ('https://upload.twitter.com/1.1/media/upload.json ' , $ url );
70
+ $ this ->assertArrayHasKey ('post ' , $ options );
71
+ $ this ->assertSame ($ options ['post ' ], [
72
+ 'command ' => 'INIT ' ,
73
+ 'total_bytes ' => 185 ,
74
+ 'media_type ' => 'image%2Fgif ' ,
75
+ 'media_category ' => 'tweet_image '
76
+ ]);
70
77
$ this ->assertArrayHasKey ('authorization ' , $ options ['normalized_headers ' ]);
71
78
72
79
return new MockResponse ('{"media_id_string":"gif123"} ' );
@@ -127,15 +134,29 @@ public function testTweetVideo()
127
134
$ transport = $ this ->createTransport (new MockHttpClient ((function () {
128
135
yield function (string $ method , string $ url , array $ options ) {
129
136
$ this ->assertSame ('POST ' , $ method );
130
- $ this ->assertSame ('https://upload.twitter.com/1.1/media/upload.json?command=INIT&total_bytes=185&media_type=image%252Fgif&media_category=tweet_video ' , $ url );
137
+ $ this ->assertSame ('https://upload.twitter.com/1.1/media/upload.json ' , $ url );
138
+ $ this ->assertArrayHasKey ('post ' , $ options );
139
+ $ this ->assertSame ($ options ['post ' ], [
140
+ 'command ' => 'INIT ' ,
141
+ 'total_bytes ' => 185 ,
142
+ 'media_type ' => 'image%2Fgif ' ,
143
+ 'media_category ' => 'tweet_video '
144
+ ]);
131
145
$ this ->assertArrayHasKey ('authorization ' , $ options ['normalized_headers ' ]);
132
146
133
147
return new MockResponse ('{"media_id_string":"gif123"} ' );
134
148
};
135
149
136
150
yield function (string $ method , string $ url , array $ options ) {
137
151
$ this ->assertSame ('POST ' , $ method);
138
- $ this ->assertSame ('https://upload.twitter.com/1.1/media/upload.json?command=INIT&total_bytes=185&media_type=image%252Fgif&media_category=subtitles ' , $ url );
152
+ $ this ->assertSame ('https://upload.twitter.com/1.1/media/upload.json ' , $ url );
153
+ $ this ->assertArrayHasKey ('post ' , $ options );
154
+ $ this ->assertSame ($ options ['post ' ], [
155
+ 'command ' => 'INIT ' ,
156
+ 'total_bytes ' => 185 ,
157
+ 'media_type ' => 'image%2Fgif ' ,
158
+ 'media_category ' => 'subtitles '
159
+ ]);
139
160
$ this ->assertArrayHasKey ('authorization ' , $ options ['normalized_headers ' ]);
140
161
141
162
return new MockResponse ('{"media_id_string":"sub234"} ' );
0 commit comments