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:
authorThomas Müller <DeepDiver1975@users.noreply.github.com>2016-04-22 18:26:26 +0300
committerThomas Müller <DeepDiver1975@users.noreply.github.com>2016-04-22 18:26:26 +0300
commit57b9ae18f055904f2a57f050b74a6640cb2f17b9 (patch)
treedf54643a9aec1320fb606f3f21bba160a6a29a60 /tests
parent98431b490e6ff013dbda7b3f6c9db13dc23868c1 (diff)
parent3e1dc647376c998f5e7752e8e7b39582144e1398 (diff)
Merge pull request #24196 from owncloud/backport-24183-change-background-job-sort-order
[9.0] Change the sort order of background jobs to be DESC instead of ASC
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/backgroundjob/joblist.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/lib/backgroundjob/joblist.php b/tests/lib/backgroundjob/joblist.php
index c0796d8253a..fcc3c440818 100644
--- a/tests/lib/backgroundjob/joblist.php
+++ b/tests/lib/backgroundjob/joblist.php
@@ -9,6 +9,7 @@
namespace Test\BackgroundJob;
use OCP\BackgroundJob\IJob;
+use OCP\IDBConnection;
use Test\TestCase;
/**
@@ -28,10 +29,17 @@ class JobList extends TestCase {
parent::setUp();
$connection = \OC::$server->getDatabaseConnection();
+ $this->clearJobsList($connection);
$this->config = $this->getMock('\OCP\IConfig');
$this->instance = new \OC\BackgroundJob\JobList($connection, $this->config);
}
+ protected function clearJobsList(IDBConnection $connection) {
+ $query = $connection->getQueryBuilder();
+ $query->delete('jobs');
+ $query->execute();
+ }
+
protected function getAllSorted() {
$jobs = $this->instance->getAll();
@@ -149,11 +157,11 @@ class JobList extends TestCase {
$this->config->expects($this->once())
->method('getAppValue')
->with('backgroundjob', 'lastjob', 0)
- ->will($this->returnValue($savedJob1->getId()));
+ ->will($this->returnValue($savedJob2->getId()));
$nextJob = $this->instance->getNext();
- $this->assertEquals($savedJob2, $nextJob);
+ $this->assertEquals($savedJob1, $nextJob);
$this->instance->remove($job, 1);
$this->instance->remove($job, 2);
@@ -166,16 +174,17 @@ class JobList extends TestCase {
$jobs = $this->getAllSorted();
+ $savedJob1 = $jobs[count($jobs) - 2];
$savedJob2 = $jobs[count($jobs) - 1];
$this->config->expects($this->once())
->method('getAppValue')
->with('backgroundjob', 'lastjob', 0)
- ->will($this->returnValue($savedJob2->getId()));
+ ->will($this->returnValue($savedJob1->getId()));
$nextJob = $this->instance->getNext();
- $this->assertEquals($jobs[0], $nextJob);
+ $this->assertEquals($savedJob2, $nextJob);
$this->instance->remove($job, 1);
$this->instance->remove($job, 2);