Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-12-04 13:49:26 +0300
committerGitHub <noreply@github.com>2019-12-04 13:49:26 +0300
commit76b78edd40fcb5dbe7f0434cbc41d2e291acfec1 (patch)
tree8a9e487e080cbdd001cd2bf5f2fb5feacb69ae25 /tests
parentd4f1cc7da6a2d7834099750827a50dcc675c64e5 (diff)
parent74c6beb603f18d51d92730bb631bfe77d8feb400 (diff)
Merge pull request #17833 from nextcloud/propagator-no-negative-sizes
dont set folder size to negative values during propagation
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/DB/QueryBuilder/FunctionBuilderTest.php20
-rw-r--r--tests/lib/Files/Cache/PropagatorTest.php11
2 files changed, 31 insertions, 0 deletions
diff --git a/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php b/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php
index d7617125faa..3d9baf35b1c 100644
--- a/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php
+++ b/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php
@@ -198,4 +198,24 @@ class FunctionBuilderTest extends TestCase {
$this->assertEquals(10, $query->execute()->fetchColumn());
}
+
+ public function testGreatest() {
+ $query = $this->connection->getQueryBuilder();
+
+ $query->select($query->func()->greatest($query->createNamedParameter(2, IQueryBuilder::PARAM_INT), new Literal(1)));
+ $query->from('appconfig')
+ ->setMaxResults(1);
+
+ $this->assertEquals(2, $query->execute()->fetchColumn());
+ }
+
+ public function testLeast() {
+ $query = $this->connection->getQueryBuilder();
+
+ $query->select($query->func()->least($query->createNamedParameter(2, IQueryBuilder::PARAM_INT), new Literal(1)));
+ $query->from('appconfig')
+ ->setMaxResults(1);
+
+ $this->assertEquals(1, $query->execute()->fetchColumn());
+ }
}
diff --git a/tests/lib/Files/Cache/PropagatorTest.php b/tests/lib/Files/Cache/PropagatorTest.php
index ce6b84ee4d0..c1822c90282 100644
--- a/tests/lib/Files/Cache/PropagatorTest.php
+++ b/tests/lib/Files/Cache/PropagatorTest.php
@@ -81,6 +81,17 @@ class PropagatorTest extends TestCase {
}
}
+ public function testSizePropagationNoNegative() {
+ $paths = ['', 'foo', 'foo/bar'];
+ $oldInfos = $this->getFileInfos($paths);
+ $this->storage->getPropagator()->propagateChange('foo/bar/file.txt', time(), -100);
+ $newInfos = $this->getFileInfos($paths);
+
+ foreach ($oldInfos as $i => $oldInfo) {
+ $this->assertEquals(-1, $newInfos[$i]->getSize());
+ }
+ }
+
public function testBatchedPropagation() {
$this->storage->mkdir('foo/baz');
$this->storage->mkdir('asd');