Add integration/unit test for the double-insert of same values
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
0757c52980
commit
85bc5edb5e
|
@ -112,4 +112,23 @@ class ProviderUserAssignmentDaoTest extends TestCase {
|
|||
$this->assertCount(1, $data);
|
||||
}
|
||||
|
||||
public function testPersistSameStateTwice() {
|
||||
$qb = $this->dbConn->getQueryBuilder();
|
||||
|
||||
$this->dao->persist('twofactor_totp', 'user123', 0);
|
||||
$this->dao->persist('twofactor_totp', 'user123', 0);
|
||||
|
||||
$q = $qb
|
||||
->select('*')
|
||||
->from(ProviderUserAssignmentDao::TABLE_NAME)
|
||||
->where($qb->expr()->eq('provider_id', $qb->createNamedParameter('twofactor_totp')))
|
||||
->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter('user123')))
|
||||
->andWhere($qb->expr()->eq('enabled', $qb->createNamedParameter(1)));
|
||||
$res = $q->execute();
|
||||
$data = $res->fetchAll();
|
||||
$res->closeCursor();
|
||||
|
||||
$this->assertCount(1, $data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue