summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-11-10 15:15:03 +0100
committerGitHub <noreply@github.com>2020-11-10 15:15:03 +0100
commitf23c2162ad2d2883f08cc88c600a7d2ed4bd8a93 (patch)
treed8bcdf4ad04525f62f8ad5a43d5b9ba6cc698a08 /apps/dav/tests/unit
parent10aa22dd45c10b7d7729f648dc8e65efb0d937ec (diff)
parent8027dcbc6f6b1653f5ebcf04b1862ac1e1f51d32 (diff)
downloadnextcloud-server-f23c2162ad2d2883f08cc88c600a7d2ed4bd8a93.tar.gz
nextcloud-server-f23c2162ad2d2883f08cc88c600a7d2ed4bd8a93.zip
Merge pull request #23993 from nextcloud/bugfix/noid/close-cursors
Don't leave cursors open
Diffstat (limited to 'apps/dav/tests/unit')
-rw-r--r--apps/dav/tests/unit/CardDAV/CardDavBackendTest.php22
-rw-r--r--apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php7
2 files changed, 25 insertions, 4 deletions
diff --git a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
index fe83a41038c..a8c7a781724 100644
--- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
+++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
@@ -549,7 +549,12 @@ class CardDavBackendTest extends TestCase {
$this->invokePrivate($backend, 'updateProperties', [$bookId, $cardUri, $vCard->serialize()]);
$query = $this->db->getQueryBuilder();
- $result = $query->select('*')->from('cards_properties')->execute()->fetchAll();
+ $query->select('*')
+ ->from('cards_properties');
+
+ $qResult = $query->execute();
+ $result = $qResult->fetchAll();
+ $qResult->closeCursor();
$this->assertSame(2, count($result));
@@ -569,7 +574,12 @@ class CardDavBackendTest extends TestCase {
$this->invokePrivate($backend, 'updateProperties', [$bookId, $cardUri, $vCard->serialize()]);
$query = $this->db->getQueryBuilder();
- $result = $query->select('*')->from('cards_properties')->execute()->fetchAll();
+ $query->select('*')
+ ->from('cards_properties');
+
+ $qResult = $query->execute();
+ $result = $qResult->fetchAll();
+ $qResult->closeCursor();
$this->assertSame(1, count($result));
@@ -609,7 +619,13 @@ class CardDavBackendTest extends TestCase {
$this->invokePrivate($this->backend, 'purgeProperties', [1, 1]);
$query = $this->db->getQueryBuilder();
- $result = $query->select('*')->from('cards_properties')->execute()->fetchAll();
+ $query->select('*')
+ ->from('cards_properties');
+
+ $qResult = $query->execute();
+ $result = $qResult->fetchAll();
+ $qResult->closeCursor();
+
$this->assertSame(1, count($result));
$this->assertSame(1 ,(int)$result[0]['addressbookid']);
$this->assertSame(2 ,(int)$result[0]['cardid']);
diff --git a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php
index 3e22193fcbf..2633ccf544f 100644
--- a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php
+++ b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php
@@ -109,7 +109,12 @@ class CustomPropertiesBackendTest extends TestCase {
->from('properties')
->where($query->expr()->eq('userid', $query->createNamedParameter($user)))
->where($query->expr()->eq('propertypath', $query->createNamedParameter($this->formatPath($path))));
- return $query->execute()->fetchAll(\PDO::FETCH_KEY_PAIR);
+
+
+ $result = $query->execute();
+ $data = $result->fetchAll(\PDO::FETCH_KEY_PAIR);
+ $result->closeCursor();
+ return $data;
}
public function testPropFindNoDbCalls() {