aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/tests
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2018-01-08 13:08:18 +0100
committerArthur Schiwon <blizzz@arthur-schiwon.de>2018-01-08 13:08:59 +0100
commitb17c5fec40769ffc0b96c42618048046beb8f85e (patch)
tree0b536c980ba17bf90f27534f6e6fda6a9084c27e /apps/user_ldap/tests
parente4310648dfcc57618c4a0d61ae73f889e08f3b53 (diff)
downloadnextcloud-server-b17c5fec40769ffc0b96c42618048046beb8f85e.tar.gz
nextcloud-server-b17c5fec40769ffc0b96c42618048046beb8f85e.zip
add unit test for qualifies to run
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/tests')
-rw-r--r--apps/user_ldap/tests/Jobs/SyncTest.php22
1 files changed, 19 insertions, 3 deletions
diff --git a/apps/user_ldap/tests/Jobs/SyncTest.php b/apps/user_ldap/tests/Jobs/SyncTest.php
index 338b1210a98..68a7887c12b 100644
--- a/apps/user_ldap/tests/Jobs/SyncTest.php
+++ b/apps/user_ldap/tests/Jobs/SyncTest.php
@@ -197,11 +197,15 @@ class SyncTest extends TestCase {
}
public function cycleDataProvider() {
- $cycle1 = ['prefix' => 's01', 'offset' => 1000];
+ $lastCycle = ['prefix' => 's01', 'offset' => 1000];
+ $lastCycle2 = ['prefix' => '', 'offset' => 1000];
return [
[ null, ['s01'], ['prefix' => 's01', 'offset' => 0] ],
- [ $cycle1, ['s01', 's02'], ['prefix' => 's02', 'offset' => 0] ],
- [ $cycle1, [], null ],
+ [ null, [''], ['prefix' => '', 'offset' => 0] ],
+ [ $lastCycle, ['s01', 's02'], ['prefix' => 's02', 'offset' => 0] ],
+ [ $lastCycle, [''], ['prefix' => '', 'offset' => 0] ],
+ [ $lastCycle2, ['', 's01'], ['prefix' => 's01', 'offset' => 0] ],
+ [ $lastCycle, [], null ],
];
}
@@ -237,4 +241,16 @@ class SyncTest extends TestCase {
}
}
+ public function testQualifiesToRun() {
+ $cycleData = ['prefix' => 's01'];
+
+ $this->config->expects($this->exactly(2))
+ ->method('getAppValue')
+ ->willReturnOnConsecutiveCalls(time() - 60*40, time() - 60*20);
+
+ $this->sync->setArgument($this->arguments);
+ $this->assertTrue($this->sync->qualifiesToRun($cycleData));
+ $this->assertFalse($this->sync->qualifiesToRun($cycleData));
+ }
+
}