Skip to content

Commit

Permalink
fix(oauth2): fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
julien-nc committed Sep 3, 2024
1 parent 1066af3 commit 48cf4a9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct(
) {
}

public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
$qbUpdate = $this->connection->getQueryBuilder();
$qbUpdate->update('oauth2_clients')
->set('secret', $qbUpdate->createParameter('updateSecret'))
Expand Down
10 changes: 5 additions & 5 deletions apps/oauth2/tests/Controller/OauthApiControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public function testRefreshTokenInvalidClient($clientId, $clientSecret) {

$client = new Client();
$client->setClientIdentifier('clientId');
$client->setSecret('hashedClientSecret');
$client->setSecret(bin2hex('hashedClientSecret'));
$this->clientMapper->method('getByUid')
->with(42)
->willReturn($client);
Expand All @@ -307,7 +307,7 @@ public function testRefreshTokenInvalidAppToken() {

$client = new Client();
$client->setClientIdentifier('clientId');
$client->setSecret('hashedClientSecret');
$client->setSecret(bin2hex('hashedClientSecret'));
$this->clientMapper->method('getByUid')
->with(42)
->willReturn($client);
Expand Down Expand Up @@ -345,7 +345,7 @@ public function testRefreshTokenValidAppToken() {

$client = new Client();
$client->setClientIdentifier('clientId');
$client->setSecret('hashedClientSecret');
$client->setSecret(bin2hex('hashedClientSecret'));
$this->clientMapper->method('getByUid')
->with(42)
->willReturn($client);
Expand Down Expand Up @@ -441,7 +441,7 @@ public function testRefreshTokenValidAppTokenBasicAuth() {

$client = new Client();
$client->setClientIdentifier('clientId');
$client->setSecret('hashedClientSecret');
$client->setSecret(bin2hex('hashedClientSecret'));
$this->clientMapper->method('getByUid')
->with(42)
->willReturn($client);
Expand Down Expand Up @@ -540,7 +540,7 @@ public function testRefreshTokenExpiredAppToken() {

$client = new Client();
$client->setClientIdentifier('clientId');
$client->setSecret('hashedClientSecret');
$client->setSecret(bin2hex('hashedClientSecret'));
$this->clientMapper->method('getByUid')
->with(42)
->willReturn($client);
Expand Down
6 changes: 3 additions & 3 deletions apps/oauth2/tests/Controller/SettingsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function testAddClient() {
$client = new Client();
$client->setName('My Client Name');
$client->setRedirectUri('https://example.com/');
$client->setSecret('MyHashedSecret');
$client->setSecret(bin2hex('MyHashedSecret'));
$client->setClientIdentifier('MyClientIdentifier');

$this->clientMapper
Expand All @@ -117,7 +117,7 @@ public function testAddClient() {
->with($this->callback(function (Client $c) {
return $c->getName() === 'My Client Name' &&
$c->getRedirectUri() === 'https://example.com/' &&
$c->getSecret() === 'MyHashedSecret' &&
$c->getSecret() === bin2hex('MyHashedSecret') &&
$c->getClientIdentifier() === 'MyClientIdentifier';
}))->willReturnCallback(function (Client $c) {
$c->setId(42);
Expand Down Expand Up @@ -160,7 +160,7 @@ public function testDeleteClient() {
$client->setId(123);
$client->setName('My Client Name');
$client->setRedirectUri('https://example.com/');
$client->setSecret('MyHashedSecret');
$client->setSecret(bin2hex('MyHashedSecret'));
$client->setClientIdentifier('MyClientIdentifier');

$this->clientMapper
Expand Down

0 comments on commit 48cf4a9

Please sign in to comment.