From 48c2f6d5a0b384cf81e254baabc19d61aae496e4 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 6 Nov 2020 14:12:40 +0100 Subject: [PATCH] Make the test pass on repeating calls Signed-off-by: Joas Schilling --- apps/oauth2/tests/Db/ClientMapperTest.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/oauth2/tests/Db/ClientMapperTest.php b/apps/oauth2/tests/Db/ClientMapperTest.php index ad1612da6b..e4a71fc104 100644 --- a/apps/oauth2/tests/Db/ClientMapperTest.php +++ b/apps/oauth2/tests/Db/ClientMapperTest.php @@ -40,6 +40,13 @@ class ClientMapperTest extends TestCase { $this->clientMapper = new ClientMapper(\OC::$server->getDatabaseConnection()); } + protected function tearDown(): void { + $query = \OC::$server->getDatabaseConnection()->getQueryBuilder(); + $query->delete('oauth2_clients')->execute(); + + parent::tearDown(); + } + public function testGetByIdentifier() { $client = new Client(); $client->setClientIdentifier('MyAwesomeClientIdentifier'); @@ -51,7 +58,6 @@ class ClientMapperTest extends TestCase { $this->assertEquals($client, $this->clientMapper->getByIdentifier('MyAwesomeClientIdentifier')); } - public function testGetByIdentifierNotExisting() { $this->expectException(\OCA\OAuth2\Exceptions\ClientNotFoundException::class); @@ -69,7 +75,6 @@ class ClientMapperTest extends TestCase { $this->assertEquals($client, $this->clientMapper->getByUid($client->getId())); } - public function testGetByUidNotExisting() { $this->expectException(\OCA\OAuth2\Exceptions\ClientNotFoundException::class);