From 59e968977c64e95fea7a7a96a77a892de5a23d7d Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Thu, 18 May 2017 16:43:29 +0200 Subject: Add test for DefaultTokenMapper Signed-off-by: Lukas Reschke --- tests/lib/Authentication/Token/DefaultTokenMapperTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/lib/Authentication/Token/DefaultTokenMapperTest.php') diff --git a/tests/lib/Authentication/Token/DefaultTokenMapperTest.php b/tests/lib/Authentication/Token/DefaultTokenMapperTest.php index 13427f7cb97..b5d24a7ab5e 100644 --- a/tests/lib/Authentication/Token/DefaultTokenMapperTest.php +++ b/tests/lib/Authentication/Token/DefaultTokenMapperTest.php @@ -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()); + } + } -- cgit v1.2.3