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/sharebymail/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/sharebymail/tests')
-rw-r--r-- | apps/sharebymail/tests/ShareByMailProviderTest.php | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/apps/sharebymail/tests/ShareByMailProviderTest.php b/apps/sharebymail/tests/ShareByMailProviderTest.php index 2cc39ff9628..6285de2188c 100644 --- a/apps/sharebymail/tests/ShareByMailProviderTest.php +++ b/apps/sharebymail/tests/ShareByMailProviderTest.php @@ -545,10 +545,13 @@ class ShareByMailProviderTest extends TestCase { ); $qb = $this->connection->getQueryBuilder(); - $result = $qb->select('*') + $qb->select('*') ->from('share') - ->where($qb->expr()->eq('id', $qb->createNamedParameter($id))) - ->execute()->fetchAll(); + ->where($qb->expr()->eq('id', $qb->createNamedParameter($id))); + + $qResult = $qb->execute(); + $result = $qResult->fetchAll(); + $qResult->closeCursor(); $this->assertSame(1, count($result)); @@ -590,10 +593,13 @@ class ShareByMailProviderTest extends TestCase { ); $qb = $this->connection->getQueryBuilder(); - $result = $qb->select('*') + $qb->select('*') ->from('share') - ->where($qb->expr()->eq('id', $qb->createNamedParameter($id))) - ->execute()->fetchAll(); + ->where($qb->expr()->eq('id', $qb->createNamedParameter($id))); + + $qResult = $qb->execute(); + $result = $qResult->fetchAll(); + $qResult->closeCursor(); $this->assertSame(1, count($result)); @@ -831,7 +837,10 @@ class ShareByMailProviderTest extends TestCase { $query = $this->connection->getQueryBuilder(); $query->select('*')->from('share') ->where($query->expr()->eq('id', $query->createNamedParameter($id))); - $before = $query->execute()->fetchAll(); + + $result = $query->execute(); + $before = $result->fetchAll(); + $result->closeCursor(); $this->assertTrue(is_array($before)); $this->assertSame(1, count($before)); @@ -841,7 +850,10 @@ class ShareByMailProviderTest extends TestCase { $query = $this->connection->getQueryBuilder(); $query->select('*')->from('share') ->where($query->expr()->eq('id', $query->createNamedParameter($id))); - $after = $query->execute()->fetchAll(); + + $result = $query->execute(); + $after = $result->fetchAll(); + $result->closeCursor(); $this->assertTrue(is_array($after)); $this->assertEmpty($after); @@ -861,7 +873,10 @@ class ShareByMailProviderTest extends TestCase { $query = $this->connection->getQueryBuilder(); $query->select('*')->from('share'); - $before = $query->execute()->fetchAll(); + + $result = $query->execute(); + $before = $result->fetchAll(); + $result->closeCursor(); $this->assertTrue(is_array($before)); $this->assertSame(2, count($before)); @@ -873,7 +888,10 @@ class ShareByMailProviderTest extends TestCase { $query = $this->connection->getQueryBuilder(); $query->select('*')->from('share'); - $after = $query->execute()->fetchAll(); + + $result = $query->execute(); + $after = $result->fetchAll(); + $result->closeCursor(); $this->assertTrue(is_array($after)); $this->assertSame(1, count($after)); |