]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add test for DefaultTokenMapper
authorLukas Reschke <lukas@statuscode.ch>
Thu, 18 May 2017 14:43:29 +0000 (16:43 +0200)
committerLukas Reschke <lukas@statuscode.ch>
Thu, 18 May 2017 18:49:09 +0000 (20:49 +0200)
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
tests/lib/Authentication/Token/DefaultTokenMapperTest.php

index 13427f7cb97906b4c3072ff0c82eddabd62f2d5d..b5d24a7ab5eae3d588c29cc4367ce52326909f0f 100644 (file)
@@ -238,4 +238,15 @@ class DefaultTokenMapperTest extends TestCase {
                $this->assertEquals(3, $this->getNumberOfTokens());
        }
 
+       public function testDeleteByName() {
+               $qb = $this->dbConnection->getQueryBuilder();
+               $qb->select('name')
+                       ->from('authtoken')
+                       ->where($qb->expr()->eq('token', $qb->createNamedParameter('9c5a2e661482b65597408a6bb6c4a3d1af36337381872ac56e445a06cdb7fea2b1039db707545c11027a4966919918b19d875a8b774840b18c6cbb7ae56fe206')));
+               $result = $qb->execute();
+               $name = $result->fetch()['name'];
+               $this->mapper->deleteByName($name);
+               $this->assertEquals(2, $this->getNumberOfTokens());
+       }
+
 }