]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(oauth2): fix tests
authorJulien Veyssier <julien-nc@posteo.net>
Fri, 30 Aug 2024 13:10:03 +0000 (15:10 +0200)
committerJulien Veyssier <julien-nc@posteo.net>
Wed, 4 Sep 2024 08:56:10 +0000 (10:56 +0200)
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
apps/oauth2/lib/Migration/Version011901Date20240829164356.php
apps/oauth2/tests/Controller/OauthApiControllerTest.php
apps/oauth2/tests/Controller/SettingsControllerTest.php

index 9ce9ff371cbdea680e985fa9f868da9c33e8240d..20f5754bf11381bcd0373f94b3739ff87f46e0ea 100644 (file)
@@ -23,7 +23,7 @@ class Version011901Date20240829164356 extends SimpleMigrationStep {
        ) {
        }
 
-       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'))
index ec4826b75e8709198f2f237aa8e3d96d71e065f9..56a49288ada1e485099c2313e42ffe22c0fd71fa 100644 (file)
@@ -282,7 +282,7 @@ class OauthApiControllerTest extends TestCase {
 
                $client = new Client();
                $client->setClientIdentifier('clientId');
-               $client->setSecret('hashedClientSecret');
+               $client->setSecret(bin2hex('hashedClientSecret'));
                $this->clientMapper->method('getByUid')
                        ->with(42)
                        ->willReturn($client);
@@ -307,7 +307,7 @@ class OauthApiControllerTest extends TestCase {
 
                $client = new Client();
                $client->setClientIdentifier('clientId');
-               $client->setSecret('hashedClientSecret');
+               $client->setSecret(bin2hex('hashedClientSecret'));
                $this->clientMapper->method('getByUid')
                        ->with(42)
                        ->willReturn($client);
@@ -345,7 +345,7 @@ class OauthApiControllerTest extends TestCase {
 
                $client = new Client();
                $client->setClientIdentifier('clientId');
-               $client->setSecret('hashedClientSecret');
+               $client->setSecret(bin2hex('hashedClientSecret'));
                $this->clientMapper->method('getByUid')
                        ->with(42)
                        ->willReturn($client);
@@ -441,7 +441,7 @@ class OauthApiControllerTest extends TestCase {
 
                $client = new Client();
                $client->setClientIdentifier('clientId');
-               $client->setSecret('hashedClientSecret');
+               $client->setSecret(bin2hex('hashedClientSecret'));
                $this->clientMapper->method('getByUid')
                        ->with(42)
                        ->willReturn($client);
@@ -540,7 +540,7 @@ class OauthApiControllerTest extends TestCase {
 
                $client = new Client();
                $client->setClientIdentifier('clientId');
-               $client->setSecret('hashedClientSecret');
+               $client->setSecret(bin2hex('hashedClientSecret'));
                $this->clientMapper->method('getByUid')
                        ->with(42)
                        ->willReturn($client);
index 06eca4f0fb9d32a4b31194a5dcbc6b4b2ea34034..0b1f0809eaa11134039e9c36e57c604ba438429b 100644 (file)
@@ -108,7 +108,7 @@ class SettingsControllerTest extends TestCase {
                $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
@@ -117,7 +117,7 @@ class SettingsControllerTest extends TestCase {
                        ->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);
@@ -160,7 +160,7 @@ class SettingsControllerTest extends TestCase {
                $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