diff options
Diffstat (limited to 'apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php')
-rw-r--r-- | apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php index 035b7da15ca..d76f93751a4 100644 --- a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php +++ b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php @@ -119,11 +119,13 @@ class RequestHandlerControllerTest extends TestCase { } protected function tearDown() { - $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share_external`'); - $query->execute(); + $qb = $this->connection->getQueryBuilder(); + $qb->delete('share_external'); + $qb->execute(); - $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share`'); - $query->execute(); + $qb = $this->connection->getQueryBuilder(); + $qb->delete('share'); + $qb->execute(); parent::tearDown(); } @@ -142,9 +144,15 @@ class RequestHandlerControllerTest extends TestCase { $this->s2s->createShare(null); - $query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share_external` WHERE `remote_id` = ?'); - $result = $query->execute(array('1')); - $data = $result->fetchRow(); + $qb = $this->connection->getQueryBuilder(); + $qb->select('*') + ->from('share_external') + ->where( + $qb->expr()->eq('remote_id', $qb->createNamedParameter(1)) + ); + $result = $qb->execute(); + $data = $result->fetch(); + $result->closeCursor(); $this->assertSame('localhost', $data['remote']); $this->assertSame('token', $data['share_token']); @@ -187,7 +195,7 @@ class RequestHandlerControllerTest extends TestCase { $this->share->expects($this->any())->method('verifyShare')->willReturn(true); - $dummy = \OCP\DB::prepare(' + $dummy = \OC_DB::prepare(' INSERT INTO `*PREFIX*share` (`share_type`, `uid_owner`, `item_type`, `item_source`, `item_target`, `file_source`, `file_target`, `permissions`, `stime`, `token`, `share_with`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) @@ -195,7 +203,7 @@ class RequestHandlerControllerTest extends TestCase { $dummy->execute(array(\OCP\Share::SHARE_TYPE_REMOTE, self::TEST_FILES_SHARING_API_USER1, 'test', '1', '/1', '1', '/test.txt', '1', time(), 'token1', 'foo@bar')); $dummy->execute(array(\OCP\Share::SHARE_TYPE_REMOTE, self::TEST_FILES_SHARING_API_USER1, 'test', '1', '/1', '1', '/test.txt', '1', time(), 'token2', 'bar@bar')); - $verify = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share`'); + $verify = \OC_DB::prepare('SELECT * FROM `*PREFIX*share`'); $result = $verify->execute(); $data = $result->fetchAll(); $this->assertCount(2, $data); @@ -203,7 +211,7 @@ class RequestHandlerControllerTest extends TestCase { $_POST['token'] = 'token1'; $this->s2s->declineShare(array('id' => $data[0]['id'])); - $verify = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share`'); + $verify = \OC_DB::prepare('SELECT * FROM `*PREFIX*share`'); $result = $verify->execute(); $data = $result->fetchAll(); $this->assertCount(1, $data); @@ -212,7 +220,7 @@ class RequestHandlerControllerTest extends TestCase { $_POST['token'] = 'token2'; $this->s2s->declineShare(array('id' => $data[0]['id'])); - $verify = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share`'); + $verify = \OC_DB::prepare('SELECT * FROM `*PREFIX*share`'); $result = $verify->execute(); $data = $result->fetchAll(); $this->assertEmpty($data); |