Skip to content

Commit 5188963

Browse files
authored
Merge pull request #1169 from abraham/v2
Default to API v2
2 parents c778679 + b0d83e4 commit 5188963

10 files changed

+11
-2
lines changed

src/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Config
2323
/** @var int Delay in seconds before we retry the request */
2424
protected $retriesDelay = 1;
2525
/** @var string Version of the Twitter API requests should target */
26-
protected $apiVersion = '1.1';
26+
protected $apiVersion = '2';
2727

2828
/**
2929
* Decode JSON Response as associative Array

tests/TwitterOAuthDirectMessagesTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ protected function setUp(): void
2424
ACCESS_TOKEN,
2525
ACCESS_TOKEN_SECRET,
2626
);
27+
$this->twitter->setApiVersion('1.1');
2728
$this->userId = explode('-', ACCESS_TOKEN)[0];
2829
}
2930

tests/TwitterOAuthFavoritesTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ protected function setUp(): void
2424
ACCESS_TOKEN,
2525
ACCESS_TOKEN_SECRET,
2626
);
27+
$this->twitter->setApiVersion('1.1');
2728
$this->userId = explode('-', ACCESS_TOKEN)[0];
2829
}
2930

tests/TwitterOAuthLastTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ protected function setUp(): void
2424
ACCESS_TOKEN,
2525
ACCESS_TOKEN_SECRET,
2626
);
27+
$this->twitter->setApiVersion('1.1');
2728
$this->userId = explode('-', ACCESS_TOKEN)[0];
2829
}
2930

tests/TwitterOAuthMediaTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ protected function setUp(): void
2424
ACCESS_TOKEN,
2525
ACCESS_TOKEN_SECRET,
2626
);
27+
$this->twitter->setApiVersion('1.1');
2728
$this->userId = explode('-', ACCESS_TOKEN)[0];
2829
}
2930

tests/TwitterOAuthOAuthTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ protected function setUp(): void
2424
ACCESS_TOKEN,
2525
ACCESS_TOKEN_SECRET,
2626
);
27+
$this->twitter->setApiVersion('1.1');
2728
$this->userId = explode('-', ACCESS_TOKEN)[0];
2829
}
2930

@@ -39,6 +40,7 @@ public function testBuildClient()
3940
public function testSetOauthToken()
4041
{
4142
$twitter = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
43+
$twitter->setApiVersion('1.1');
4244
$twitter->setOauthToken(ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
4345
$this->assertObjectHasAttribute('consumer', $twitter);
4446
$this->assertObjectHasAttribute('token', $twitter);
@@ -76,6 +78,7 @@ public function testOauth2BearerToken($accessToken)
7678
null,
7779
$accessToken->access_token,
7880
);
81+
$twitter->setApiVersion('1.1');
7982
$result = $twitter->get('statuses/user_timeline', [
8083
'screen_name' => 'twitterapi',
8184
]);

tests/TwitterOAuthProxyTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ protected function setUp(): void
2424
ACCESS_TOKEN,
2525
ACCESS_TOKEN_SECRET,
2626
);
27+
$this->twitter->setApiVersion('1.1');
2728
$this->userId = explode('-', ACCESS_TOKEN)[0];
2829
}
2930

tests/TwitterOAuthStatusesTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ protected function setUp(): void
2424
ACCESS_TOKEN,
2525
ACCESS_TOKEN_SECRET,
2626
);
27+
$this->twitter->setApiVersion('1.1');
2728
$this->userId = explode('-', ACCESS_TOKEN)[0];
2829
}
2930

tests/TwitterOAuthTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ protected function setUp(): void
2424
ACCESS_TOKEN,
2525
ACCESS_TOKEN_SECRET,
2626
);
27+
$this->twitter->setApiVersion('1.1');
2728
$this->userId = explode('-', ACCESS_TOKEN)[0];
2829
}
2930

tests/TwitterOAuthV2Test.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ protected function setUp(): void
2626
ACCESS_TOKEN_SECRET,
2727
);
2828
$this->userId = explode('-', ACCESS_TOKEN)[0];
29-
$this->twitter->setApiVersion('2');
3029
}
3130

3231
/**

0 commit comments

Comments
 (0)