diff options
author | Joas Schilling <coding@schilljs.com> | 2020-11-05 10:50:53 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-11-09 12:28:17 +0100 |
commit | 8027dcbc6f6b1653f5ebcf04b1862ac1e1f51d32 (patch) | |
tree | 1bf182f477bfbead7b75ae14a8cd0fce5bb38ada /apps/dav/tests | |
parent | 72545ffd07a07f142c9c18b3e4afc9ae1b5c8da2 (diff) | |
download | nextcloud-server-8027dcbc6f6b1653f5ebcf04b1862ac1e1f51d32.tar.gz nextcloud-server-8027dcbc6f6b1653f5ebcf04b1862ac1e1f51d32.zip |
Don't leave cursors open when tests fail
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/dav/tests')
-rw-r--r-- | apps/dav/tests/unit/CardDAV/CardDavBackendTest.php | 22 | ||||
-rw-r--r-- | apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php | 7 |
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() { |