aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-12-05 10:41:13 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2022-12-05 10:41:13 +0100
commit578648a062e9cb72248a2f625ac367d19033a24e (patch)
tree3819f15ab39d5480042c71b57c9d27c2475a3ca4 /apps
parenta0f6a6545b59b1061e96e7d17d8ec6d6f32e615e (diff)
downloadnextcloud-server-578648a062e9cb72248a2f625ac367d19033a24e.tar.gz
nextcloud-server-578648a062e9cb72248a2f625ac367d19033a24e.zip
Adapt tests to new job constructors
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php13
-rw-r--r--apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php4
2 files changed, 10 insertions, 7 deletions
diff --git a/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php b/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php
index 75318b1802f..f7562345d8a 100644
--- a/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php
+++ b/apps/files/tests/BackgroundJob/DeleteOrphanedItemsJobTest.php
@@ -24,6 +24,7 @@
namespace OCA\Files\Tests\BackgroundJob;
use OCA\Files\BackgroundJob\DeleteOrphanedItems;
+use OCP\AppFramework\Utility\ITimeFactory;
use OCP\DB\QueryBuilder\IQueryBuilder;
/**
@@ -34,13 +35,15 @@ use OCP\DB\QueryBuilder\IQueryBuilder;
* @package Test\BackgroundJob
*/
class DeleteOrphanedItemsJobTest extends \Test\TestCase {
-
/** @var \OCP\IDBConnection */
protected $connection;
+ protected ITimeFactory $timeFactory;
+
protected function setUp(): void {
parent::setUp();
$this->connection = \OC::$server->getDatabaseConnection();
+ $this->timeFactory = $this->createMock(ITimeFactory::class);
}
protected function cleanMapping($table) {
@@ -95,7 +98,7 @@ class DeleteOrphanedItemsJobTest extends \Test\TestCase {
$mapping = $this->getMappings('systemtag_object_mapping');
$this->assertCount(2, $mapping);
- $job = new DeleteOrphanedItems();
+ $job = new DeleteOrphanedItems($this->timeFactory);
$this->invokePrivate($job, 'cleanSystemTags');
$mapping = $this->getMappings('systemtag_object_mapping');
@@ -144,7 +147,7 @@ class DeleteOrphanedItemsJobTest extends \Test\TestCase {
$mapping = $this->getMappings('vcategory_to_object');
$this->assertCount(2, $mapping);
- $job = new DeleteOrphanedItems();
+ $job = new DeleteOrphanedItems($this->timeFactory);
$this->invokePrivate($job, 'cleanUserTags');
$mapping = $this->getMappings('vcategory_to_object');
@@ -195,7 +198,7 @@ class DeleteOrphanedItemsJobTest extends \Test\TestCase {
$mapping = $this->getMappings('comments');
$this->assertCount(2, $mapping);
- $job = new DeleteOrphanedItems();
+ $job = new DeleteOrphanedItems($this->timeFactory);
$this->invokePrivate($job, 'cleanComments');
$mapping = $this->getMappings('comments');
@@ -244,7 +247,7 @@ class DeleteOrphanedItemsJobTest extends \Test\TestCase {
$mapping = $this->getMappings('comments_read_markers');
$this->assertCount(2, $mapping);
- $job = new DeleteOrphanedItems();
+ $job = new DeleteOrphanedItems($this->timeFactory);
$this->invokePrivate($job, 'cleanCommentMarkers');
$mapping = $this->getMappings('comments_read_markers');
diff --git a/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php b/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php
index d2f05002a68..3de40215f15 100644
--- a/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php
+++ b/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php
@@ -27,6 +27,7 @@
namespace OCA\Files_Sharing\Tests;
use OCA\Files_Sharing\DeleteOrphanedSharesJob;
+use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Share\IShare;
/**
@@ -37,7 +38,6 @@ use OCP\Share\IShare;
* @package OCA\Files_Sharing\Tests
*/
class DeleteOrphanedSharesJobTest extends \Test\TestCase {
-
/**
* @var bool
*/
@@ -94,7 +94,7 @@ class DeleteOrphanedSharesJobTest extends \Test\TestCase {
\OC::registerShareHooks(\OC::$server->getSystemConfig());
- $this->job = new DeleteOrphanedSharesJob();
+ $this->job = new DeleteOrphanedSharesJob(\OCP\Server::get(ITimeFactory::class));
}
protected function tearDown(): void {