diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2023-03-31 15:29:26 +0200 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2023-04-03 09:41:16 +0000 |
commit | 7f3af46690329f70162b6513eb6c68d63e27a0d3 (patch) | |
tree | c33b37b603daec7dcc9962193e04ab47f5cae68f /tests | |
parent | 1845187314aeb364b4812906e16476584c7c0c3e (diff) | |
download | nextcloud-server-7f3af46690329f70162b6513eb6c68d63e27a0d3.tar.gz nextcloud-server-7f3af46690329f70162b6513eb6c68d63e27a0d3.zip |
fix DBAL exception handling in setValues
This seems to be a left over after abstracting DBAL. Nowadays,
IQueryBuilder::executeStatement() only throws a \OCP\DB\Exception, where
previously original DBAL exceptions where thrown. These are now wrapped,
the orignal classes are now mapped to a reason.
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Security/CredentialsManagerTest.php | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/lib/Security/CredentialsManagerTest.php b/tests/lib/Security/CredentialsManagerTest.php index 6f535c84275..bb4feb8b6a9 100644 --- a/tests/lib/Security/CredentialsManagerTest.php +++ b/tests/lib/Security/CredentialsManagerTest.php @@ -24,6 +24,9 @@ declare(strict_types=1); namespace Test\Security; +use OCP\Security\ICredentialsManager; +use OCP\Server; + /** * @group DB */ @@ -32,7 +35,7 @@ class CredentialsManagerTest extends \Test\TestCase { * @dataProvider credentialsProvider */ public function testWithDB($userId, $identifier) { - $credentialsManager = \OC::$server->getCredentialsManager(); + $credentialsManager = Server::get(ICredentialsManager::class); $secrets = 'Open Sesame'; @@ -45,7 +48,23 @@ class CredentialsManagerTest extends \Test\TestCase { $this->assertSame(1, $removedRows); } - public function credentialsProvider() { + /** + * @dataProvider credentialsProvider + */ + public function testUpdate($userId, $identifier): void { + $credentialsManager = Server::get(ICredentialsManager::class); + + $secrets = 'Open Sesame'; + $secretsRev = strrev($secrets); + + $credentialsManager->store($userId, $identifier, $secrets); + $credentialsManager->store($userId, $identifier, $secretsRev); + $received = $credentialsManager->retrieve($userId, $identifier); + + $this->assertSame($secretsRev, $received); + } + + public function credentialsProvider(): array { return [ [ 'alice', |