Skip to content

Commit

Permalink
only nc26+ supported
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
  • Loading branch information
Grotax committed Aug 11, 2023
1 parent f64b9b6 commit a825d4f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
8 changes: 2 additions & 6 deletions lib/Service/StatusService.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,8 @@ public function getUpdateTime(): int

$time = 0;

[$major, $minor, $micro] = Util::getVersion();

if ($major >= 26) {
$myJobList = $this->jobList->getJobsIterator(UpdaterJob::class, 1, 0);
$time = $myJobList->current()->getLastRun();
}
$myJobList = $this->jobList->getJobsIterator(UpdaterJob::class, 1, 0);
$time = $myJobList->current()->getLastRun();

return $time;
}
Expand Down
17 changes: 13 additions & 4 deletions tests/Unit/Service/FolderServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace OCA\News\Tests\Unit\Service;

use DateTime;
use DateTimeImmutable;
use OC\AppFramework\Utility\TimeFactory;
use OCA\News\Db\Feed;
use \OCA\News\Db\Folder;
Expand Down Expand Up @@ -48,10 +50,15 @@ class FolderServiceTest extends TestCase
private $class;

/**
* @var int
* @var DateTimeImmutable
*/
private $time;

/**
* @var int
*/
private $timestamp;

/**
* @var string
*/
Expand All @@ -64,12 +71,14 @@ class FolderServiceTest extends TestCase

protected function setUp(): void
{
$this->time = 222;
$this->time = new DateTimeImmutable("now");
$this->timestamp = $this->time->getTimestamp();

$timeFactory = $this->getMockBuilder(TimeFactory::class)
->disableOriginalConstructor()
->getMock();
$timeFactory->expects($this->any())
->method('getTime')
->method('now')
->will($this->returnValue($this->time));

$this->feedService = $this->getMockBuilder(FeedServiceV2::class)
Expand Down Expand Up @@ -192,7 +201,7 @@ public function testMarkDeleted()
{
$folder = new Folder();
$folder2 = new Folder();
$folder2->setDeletedAt($this->time);
$folder2->setDeletedAt($this->timestamp);

$this->mapper->expects($this->once())
->method('findFromUser')
Expand Down

0 comments on commit a825d4f

Please sign in to comment.