]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add a unit test that executes the query
authorJoas Schilling <nickvergessen@owncloud.com>
Wed, 18 Nov 2015 09:32:29 +0000 (10:32 +0100)
committerJoas Schilling <nickvergessen@owncloud.com>
Mon, 30 Nov 2015 16:14:47 +0000 (17:14 +0100)
apps/files/tests/activitytest.php

index 485c559d488bfc5da0cc123db092285fab861d57..f6a21a7db62f24c4a98461ccd268b16a6409e209 100644 (file)
@@ -333,6 +333,21 @@ class ActivityTest extends TestCase {
 
                $result = $this->activityExtension->getQueryForFilter('all');
                $this->assertEquals([$query, $parameters], $result);
+
+               $this->executeQueryForFilter($result);
+       }
+
+       public function executeQueryForFilter(array $result) {
+               list($resultQuery, $resultParameters) = $result;
+               $resultQuery = str_replace('`file`', '`user`', $resultQuery);
+               $resultQuery = str_replace('`type`', '`key`', $resultQuery);
+
+               $connection = \OC::$server->getDatabaseConnection();
+               // Test the query on the privatedata table, because the activity table
+               // does not exist in core
+               $result = $connection->executeQuery('SELECT * FROM `*PREFIX*privatedata` WHERE ' . $resultQuery, $resultParameters);
+               $rows = $result->fetchAll();
+               $result->closeCursor();
        }
 
        protected function mockUserSession($user) {