diff --git a/composer.json b/composer.json index fef88f178..4dc5ba549 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "phpunit/phpunit": "^8.5", "nextcloud/coding-standard": "^0.5.0", "psalm/phar": "^4.3", - "christophwurst/nextcloud": "dev-stable23" + "christophwurst/nextcloud": "^23.0.0" }, "config": { "optimize-autoloader": true, diff --git a/composer.lock b/composer.lock index 1fed26872..9de749602 100644 --- a/composer.lock +++ b/composer.lock @@ -4,21 +4,21 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5ea89ac54d15d8d1f3f0dc97abf3f71d", + "content-hash": "3dfa62425c3447ce96869218b7383d46", "packages": [], "packages-dev": [ { "name": "christophwurst/nextcloud", - "version": "dev-stable23", + "version": "v23.0.2", "source": { "type": "git", "url": "https://github.com/ChristophWurst/nextcloud_composer.git", - "reference": "35a9fd3850885765a670b95f9bfa18c55245e7ac" + "reference": "7f7b957934d22205aab66c568ac3029bd8f2110d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ChristophWurst/nextcloud_composer/zipball/35a9fd3850885765a670b95f9bfa18c55245e7ac", - "reference": "35a9fd3850885765a670b95f9bfa18c55245e7ac", + "url": "https://api.github.com/repos/ChristophWurst/nextcloud_composer/zipball/7f7b957934d22205aab66c568ac3029bd8f2110d", + "reference": "7f7b957934d22205aab66c568ac3029bd8f2110d", "shasum": "" }, "require": { @@ -46,9 +46,9 @@ "description": "Composer package containing Nextcloud's public API (classes, interfaces)", "support": { "issues": "https://github.com/ChristophWurst/nextcloud_composer/issues", - "source": "https://github.com/ChristophWurst/nextcloud_composer/tree/stable23" + "source": "https://github.com/ChristophWurst/nextcloud_composer/tree/v23.0.2" }, - "time": "2022-02-22T09:38:33+00:00" + "time": "2022-02-22T09:41:29+00:00" }, { "name": "composer/semver", @@ -3841,9 +3841,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "christophwurst/nextcloud": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": [], @@ -3851,5 +3849,5 @@ "platform-overrides": { "php": "7.3" }, - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.2.0" } diff --git a/lib/BackgroundJob/ExpireActivities.php b/lib/BackgroundJob/ExpireActivities.php index ed5f152a7..8eaa80c21 100644 --- a/lib/BackgroundJob/ExpireActivities.php +++ b/lib/BackgroundJob/ExpireActivities.php @@ -1,4 +1,6 @@ setInterval(60 * 60 * 24); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); $this->data = $data; $this->config = $config; } - protected function run($argument) { + protected function run($argument): void { // Remove activities that are older then one year $expireDays = $this->config->getSystemValue('activity_expire_days', 365); $this->data->expire($expireDays); diff --git a/tests/AppInfo/ApplicationTest.php b/tests/AppInfo/ApplicationTest.php index 9ef52a5bf..0835af8d2 100644 --- a/tests/AppInfo/ApplicationTest.php +++ b/tests/AppInfo/ApplicationTest.php @@ -104,7 +104,7 @@ public function queryData(): array { [EmailNotification::class], [EmailNotification::class, TimedJob::class], [ExpireActivities::class,], - [ExpireActivities::class, TimedJob::class], + [ExpireActivities::class, \OCP\BackgroundJob\TimedJob::class], // Controller [ActivitiesController::class], @@ -131,6 +131,6 @@ public function testContainerQuery(string $service, ?string $expected = null): v if ($expected === null) { $expected = $service; } - $this->assertInstanceOf($expected, $this->container->query($service)); + $this->assertInstanceOf($expected, $this->container->get($service)); } } diff --git a/tests/BackgroundJob/ExpireActivitiesTest.php b/tests/BackgroundJob/ExpireActivitiesTest.php index 9fcbd2d05..1732d7610 100644 --- a/tests/BackgroundJob/ExpireActivitiesTest.php +++ b/tests/BackgroundJob/ExpireActivitiesTest.php @@ -28,6 +28,7 @@ use OCA\Activity\BackgroundJob\ExpireActivities; use OCA\Activity\Data; use OCA\Activity\Tests\TestCase; +use OCP\AppFramework\Utility\ITimeFactory; use OCP\IConfig; use OCP\BackgroundJob\IJobList; @@ -40,6 +41,7 @@ class ExpireActivitiesTest extends TestCase { public function testExecute(): void { $backgroundJob = new ExpireActivities( + $this->createMock(ITimeFactory::class), $this->createMock(Data::class), $this->createMock(IConfig::class) ); diff --git a/tests/DataDeleteActivitiesTest.php b/tests/DataDeleteActivitiesTest.php index bda615ef2..b910b5035 100644 --- a/tests/DataDeleteActivitiesTest.php +++ b/tests/DataDeleteActivitiesTest.php @@ -29,6 +29,7 @@ use OCA\Activity\BackgroundJob\ExpireActivities; use OCA\Activity\Data; use OCP\Activity\IExtension; +use OCP\AppFramework\Utility\ITimeFactory; use OCP\DB\IPreparedStatement; use OCP\IConfig; use OCP\IUserSession; @@ -107,10 +108,15 @@ public function testDeleteActivities(array $condition, array $expected): void { public function testExpireActivities(): void { $config = $this->createMock(IConfig::class); + $time = $this->createMock(ITimeFactory::class); + $time->method('getTime') + ->willReturn(time()); $backgroundjob = new ExpireActivities( + $time, $this->data, $config ); + $backgroundjob->setId(1); $this->assertUserActivities(['delete', 'otherUser']); $jobList = $this->createMock(IJobList::class); $backgroundjob->execute($jobList);