summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/tests/unit/CardDAV/CardDavBackendTest.php')
-rw-r--r--apps/dav/tests/unit/CardDAV/CardDavBackendTest.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
index 425e7c44ba7..deed0a06d29 100644
--- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
+++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
@@ -55,6 +55,7 @@ use Sabre\DAV\PropPatch;
use Sabre\VObject\Component\VCard;
use Sabre\VObject\Property\Text;
use Test\TestCase;
+use function time;
/**
* Class CardDavBackendTest
@@ -859,7 +860,12 @@ class CardDavBackendTest extends TestCase {
$uri = $this->getUniqueID('card');
$this->backend->createCard($addressBookId, $uri, $this->vcardTest0);
$this->backend->updateCard($addressBookId, $uri, $this->vcardTest1);
- $deleted = $this->backend->pruneOutdatedSyncTokens(0);
+
+ // Do not delete anything if week data as old as ts=0
+ $deleted = $this->backend->pruneOutdatedSyncTokens(0, 0);
+ self::assertSame(0, $deleted);
+
+ $deleted = $this->backend->pruneOutdatedSyncTokens(0, time());
// At least one from the object creation and one from the object update
$this->assertGreaterThanOrEqual(2, $deleted);
$changes = $this->backend->getChangesForAddressBook($addressBookId, $syncToken, 1);
@@ -891,7 +897,7 @@ class CardDavBackendTest extends TestCase {
$this->assertEmpty($changes['deleted']);
// Delete all but last change
- $deleted = $this->backend->pruneOutdatedSyncTokens(1);
+ $deleted = $this->backend->pruneOutdatedSyncTokens(1, time());
$this->assertEquals(1, $deleted); // We had two changes before, now one
// Only update should remain
@@ -899,8 +905,8 @@ class CardDavBackendTest extends TestCase {
$this->assertEmpty($changes['added']);
$this->assertEquals(1, count($changes['modified']));
$this->assertEmpty($changes['deleted']);
-
+
// Check that no crash occurs when prune is called without current changes
- $deleted = $this->backend->pruneOutdatedSyncTokens(1);
+ $deleted = $this->backend->pruneOutdatedSyncTokens(1, time());
}
}