aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-03-25 20:18:58 +0100
committerVincent Petry <pvince81@owncloud.com>2014-03-25 20:18:58 +0100
commitec9260647a5ec0bb62065eba6bfa004b6d2c696c (patch)
tree3adbe2d7f36855e12cc2d5d02b11a747e154401a /apps
parent206364cd1c25e577544159a9822c9395a516d38a (diff)
downloadnextcloud-server-ec9260647a5ec0bb62065eba6bfa004b6d2c696c.tar.gz
nextcloud-server-ec9260647a5ec0bb62065eba6bfa004b6d2c696c.zip
Fixed share updater unit test
Now using \OC_DB::insertId() to retrieve the generated ids because Oracle ignores the passed values.
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/tests/updater.php18
1 files changed, 10 insertions, 8 deletions
diff --git a/apps/files_sharing/tests/updater.php b/apps/files_sharing/tests/updater.php
index 1148399bf95..993bf0169e7 100644
--- a/apps/files_sharing/tests/updater.php
+++ b/apps/files_sharing/tests/updater.php
@@ -30,21 +30,23 @@ class Test_Files_Sharing_Updater extends \PHPUnit_Framework_TestCase {
// FIXME: DIRTY HACK - TODO: find tests, that don't clean up and fix it there
$this->tearDown();
- $addShares = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (`file_source`, `id`, `item_type`, `uid_owner`) VALUES (?, ?, \'file\', 1)');
- $shares = array(1, 2, 3);
- foreach($shares as $share) {
- // the number is used as item_source and id
- $addShares->execute(array($share, $share));
- }
// add items except one - because this is the test case for the broken share table
$addItems = \OC_DB::prepare('INSERT INTO `*PREFIX*filecache` (`fileid`, `storage`, `path_hash`, ' .
'`parent`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`) ' .
'VALUES (?, 1, ?, 1, 1, 1, 1, 1, 1)');
$items = array(1, 3);
+ $fileIds = array();
foreach($items as $item) {
// the number is used as file_id and path_hash
$addItems->execute(array($item, $item));
+ $fileIds[] = \OC_DB::insertId('*PREFIX*filecache');
}
+
+ $addShares = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (`file_source`, `id`, `item_type`, `uid_owner`) VALUES (?, ?, \'file\', 1)');
+ // the number is used as item_source and id
+ $addShares->execute(array(1, $fileIds[0]));
+ $addShares->execute(array(2, 200)); // id of "deleted" file
+ $addShares->execute(array(3, $fileIds[1]));
}
function tearDown() {
@@ -76,8 +78,8 @@ class Test_Files_Sharing_Updater extends \PHPUnit_Framework_TestCase {
$result = $countShares->execute()->fetchOne();
$this->assertEquals(2, $result);
- // check if the share of file '2' is removed as there is no entry for this in filecache table
- $countShares = \OC_DB::prepare('SELECT COUNT(`id`) FROM `*PREFIX*share` WHERE `file_source` = 2');
+ // check if the share of file '200' is removed as there is no entry for this in filecache table
+ $countShares = \OC_DB::prepare('SELECT COUNT(`id`) FROM `*PREFIX*share` WHERE `file_source` = 200');
$result = $countShares->execute()->fetchOne();
$this->assertEquals(0, $result);