From b0d83e4201cad4e656a79ec0f4a852965a8a1273 Mon Sep 17 00:00:00 2001 From: Abraham Williams <4braham@gmail.com> Date: Sun, 14 May 2023 10:42:54 -0500 Subject: [PATCH] Default to API v2 --- src/Config.php | 2 +- tests/TwitterOAuthDirectMessagesTest.php | 1 + tests/TwitterOAuthFavoritesTest.php | 1 + tests/TwitterOAuthLastTest.php | 1 + tests/TwitterOAuthMediaTest.php | 1 + tests/TwitterOAuthOAuthTest.php | 3 +++ tests/TwitterOAuthProxyTest.php | 1 + tests/TwitterOAuthStatusesTest.php | 1 + tests/TwitterOAuthTest.php | 1 + tests/TwitterOAuthV2Test.php | 1 - 10 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Config.php b/src/Config.php index 310a572d..b9cae2ab 100644 --- a/src/Config.php +++ b/src/Config.php @@ -23,7 +23,7 @@ class Config /** @var int Delay in seconds before we retry the request */ protected $retriesDelay = 1; /** @var string Version of the Twitter API requests should target */ - protected $apiVersion = '1.1'; + protected $apiVersion = '2'; /** * Decode JSON Response as associative Array diff --git a/tests/TwitterOAuthDirectMessagesTest.php b/tests/TwitterOAuthDirectMessagesTest.php index 64d83dce..fab15a11 100644 --- a/tests/TwitterOAuthDirectMessagesTest.php +++ b/tests/TwitterOAuthDirectMessagesTest.php @@ -24,6 +24,7 @@ protected function setUp(): void ACCESS_TOKEN, ACCESS_TOKEN_SECRET, ); + $this->twitter->setApiVersion('1.1'); $this->userId = explode('-', ACCESS_TOKEN)[0]; } diff --git a/tests/TwitterOAuthFavoritesTest.php b/tests/TwitterOAuthFavoritesTest.php index 9cc81694..199bda5b 100644 --- a/tests/TwitterOAuthFavoritesTest.php +++ b/tests/TwitterOAuthFavoritesTest.php @@ -24,6 +24,7 @@ protected function setUp(): void ACCESS_TOKEN, ACCESS_TOKEN_SECRET, ); + $this->twitter->setApiVersion('1.1'); $this->userId = explode('-', ACCESS_TOKEN)[0]; } diff --git a/tests/TwitterOAuthLastTest.php b/tests/TwitterOAuthLastTest.php index cc9499c7..525cf7aa 100644 --- a/tests/TwitterOAuthLastTest.php +++ b/tests/TwitterOAuthLastTest.php @@ -24,6 +24,7 @@ protected function setUp(): void ACCESS_TOKEN, ACCESS_TOKEN_SECRET, ); + $this->twitter->setApiVersion('1.1'); $this->userId = explode('-', ACCESS_TOKEN)[0]; } diff --git a/tests/TwitterOAuthMediaTest.php b/tests/TwitterOAuthMediaTest.php index 8b15a958..b28c3501 100644 --- a/tests/TwitterOAuthMediaTest.php +++ b/tests/TwitterOAuthMediaTest.php @@ -24,6 +24,7 @@ protected function setUp(): void ACCESS_TOKEN, ACCESS_TOKEN_SECRET, ); + $this->twitter->setApiVersion('1.1'); $this->userId = explode('-', ACCESS_TOKEN)[0]; } diff --git a/tests/TwitterOAuthOAuthTest.php b/tests/TwitterOAuthOAuthTest.php index 19df72ad..39b6e24b 100644 --- a/tests/TwitterOAuthOAuthTest.php +++ b/tests/TwitterOAuthOAuthTest.php @@ -24,6 +24,7 @@ protected function setUp(): void ACCESS_TOKEN, ACCESS_TOKEN_SECRET, ); + $this->twitter->setApiVersion('1.1'); $this->userId = explode('-', ACCESS_TOKEN)[0]; } @@ -39,6 +40,7 @@ public function testBuildClient() public function testSetOauthToken() { $twitter = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET); + $twitter->setApiVersion('1.1'); $twitter->setOauthToken(ACCESS_TOKEN, ACCESS_TOKEN_SECRET); $this->assertObjectHasAttribute('consumer', $twitter); $this->assertObjectHasAttribute('token', $twitter); @@ -76,6 +78,7 @@ public function testOauth2BearerToken($accessToken) null, $accessToken->access_token, ); + $twitter->setApiVersion('1.1'); $result = $twitter->get('statuses/user_timeline', [ 'screen_name' => 'twitterapi', ]); diff --git a/tests/TwitterOAuthProxyTest.php b/tests/TwitterOAuthProxyTest.php index 096e5a25..d9bfc7bc 100644 --- a/tests/TwitterOAuthProxyTest.php +++ b/tests/TwitterOAuthProxyTest.php @@ -24,6 +24,7 @@ protected function setUp(): void ACCESS_TOKEN, ACCESS_TOKEN_SECRET, ); + $this->twitter->setApiVersion('1.1'); $this->userId = explode('-', ACCESS_TOKEN)[0]; } diff --git a/tests/TwitterOAuthStatusesTest.php b/tests/TwitterOAuthStatusesTest.php index 2318d40f..8518b3da 100644 --- a/tests/TwitterOAuthStatusesTest.php +++ b/tests/TwitterOAuthStatusesTest.php @@ -24,6 +24,7 @@ protected function setUp(): void ACCESS_TOKEN, ACCESS_TOKEN_SECRET, ); + $this->twitter->setApiVersion('1.1'); $this->userId = explode('-', ACCESS_TOKEN)[0]; } diff --git a/tests/TwitterOAuthTest.php b/tests/TwitterOAuthTest.php index 521292d3..fbf35fcb 100644 --- a/tests/TwitterOAuthTest.php +++ b/tests/TwitterOAuthTest.php @@ -24,6 +24,7 @@ protected function setUp(): void ACCESS_TOKEN, ACCESS_TOKEN_SECRET, ); + $this->twitter->setApiVersion('1.1'); $this->userId = explode('-', ACCESS_TOKEN)[0]; } diff --git a/tests/TwitterOAuthV2Test.php b/tests/TwitterOAuthV2Test.php index 0804d027..8714cc7d 100644 --- a/tests/TwitterOAuthV2Test.php +++ b/tests/TwitterOAuthV2Test.php @@ -26,7 +26,6 @@ protected function setUp(): void ACCESS_TOKEN_SECRET, ); $this->userId = explode('-', ACCESS_TOKEN)[0]; - $this->twitter->setApiVersion('2'); } /**