Skip to content

Commit

Permalink
Merge pull request #1169 from abraham/v2
Browse files Browse the repository at this point in the history
Default to API v2
  • Loading branch information
abraham authored Jul 24, 2023
2 parents c778679 + b0d83e4 commit 5188963
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/TwitterOAuthDirectMessagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ protected function setUp(): void
ACCESS_TOKEN,
ACCESS_TOKEN_SECRET,
);
$this->twitter->setApiVersion('1.1');
$this->userId = explode('-', ACCESS_TOKEN)[0];
}

Expand Down
1 change: 1 addition & 0 deletions tests/TwitterOAuthFavoritesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ protected function setUp(): void
ACCESS_TOKEN,
ACCESS_TOKEN_SECRET,
);
$this->twitter->setApiVersion('1.1');
$this->userId = explode('-', ACCESS_TOKEN)[0];
}

Expand Down
1 change: 1 addition & 0 deletions tests/TwitterOAuthLastTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ protected function setUp(): void
ACCESS_TOKEN,
ACCESS_TOKEN_SECRET,
);
$this->twitter->setApiVersion('1.1');
$this->userId = explode('-', ACCESS_TOKEN)[0];
}

Expand Down
1 change: 1 addition & 0 deletions tests/TwitterOAuthMediaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ protected function setUp(): void
ACCESS_TOKEN,
ACCESS_TOKEN_SECRET,
);
$this->twitter->setApiVersion('1.1');
$this->userId = explode('-', ACCESS_TOKEN)[0];
}

Expand Down
3 changes: 3 additions & 0 deletions tests/TwitterOAuthOAuthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ protected function setUp(): void
ACCESS_TOKEN,
ACCESS_TOKEN_SECRET,
);
$this->twitter->setApiVersion('1.1');
$this->userId = explode('-', ACCESS_TOKEN)[0];
}

Expand All @@ -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);
Expand Down Expand Up @@ -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',
]);
Expand Down
1 change: 1 addition & 0 deletions tests/TwitterOAuthProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ protected function setUp(): void
ACCESS_TOKEN,
ACCESS_TOKEN_SECRET,
);
$this->twitter->setApiVersion('1.1');
$this->userId = explode('-', ACCESS_TOKEN)[0];
}

Expand Down
1 change: 1 addition & 0 deletions tests/TwitterOAuthStatusesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ protected function setUp(): void
ACCESS_TOKEN,
ACCESS_TOKEN_SECRET,
);
$this->twitter->setApiVersion('1.1');
$this->userId = explode('-', ACCESS_TOKEN)[0];
}

Expand Down
1 change: 1 addition & 0 deletions tests/TwitterOAuthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ protected function setUp(): void
ACCESS_TOKEN,
ACCESS_TOKEN_SECRET,
);
$this->twitter->setApiVersion('1.1');
$this->userId = explode('-', ACCESS_TOKEN)[0];
}

Expand Down
1 change: 0 additions & 1 deletion tests/TwitterOAuthV2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ protected function setUp(): void
ACCESS_TOKEN_SECRET,
);
$this->userId = explode('-', ACCESS_TOKEN)[0];
$this->twitter->setApiVersion('2');
}

/**
Expand Down

0 comments on commit 5188963

Please sign in to comment.