summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBenjamin Brahmer <info@b-brahmer.de>2023-03-20 14:08:52 +0100
committerBenjamin Brahmer <info@b-brahmer.de>2023-08-22 09:47:11 +0200
commit17f0fc7f4a4ffeaa004227755c9926276904a9be (patch)
tree45dbc1691323a0849560a367f352be27cb29a193 /tests
parentca9e07b3ba6969a45f98c710c3a137299ad93b01 (diff)
Add a command to check the job status and reset it
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/Unit/Service/UpdaterTest.php14
-rw-r--r--tests/command/update.bats21
m---------tests/test_helper/bats-assert0
3 files changed, 34 insertions, 1 deletions
diff --git a/tests/Unit/Service/UpdaterTest.php b/tests/Unit/Service/UpdaterTest.php
index b4be0a7cc..3d5ca2252 100644
--- a/tests/Unit/Service/UpdaterTest.php
+++ b/tests/Unit/Service/UpdaterTest.php
@@ -18,6 +18,8 @@ use OCA\News\Service\FolderServiceV2;
use OCA\News\Service\ItemServiceV2;
use OCA\News\Service\UpdaterService;
use PHPUnit\Framework\TestCase;
+use OCP\BackgroundJob\IJobList;
+use OCP\BackgroundJob\IJob;
class UpdaterTest extends TestCase
{
@@ -42,6 +44,11 @@ class UpdaterTest extends TestCase
*/
private $updater;
+ /**
+ * @var \PHPUnit\Framework\MockObject\MockObject|IJobList
+ */
+ private $jobList;
+
protected function setUp(): void
{
$this->folderService = $this->getMockBuilder(FolderServiceV2::class)
@@ -53,10 +60,14 @@ class UpdaterTest extends TestCase
$this->itemService = $this->getMockBuilder(ItemServiceV2::class)
->disableOriginalConstructor()
->getMock();
+ $this->jobList = $this->getMockBuilder(IJobList::class)
+ ->disableOriginalConstructor()
+ ->getMock();
$this->updater = new UpdaterService(
$this->folderService,
$this->feedService,
- $this->itemService
+ $this->itemService,
+ $this->jobList
);
}
@@ -83,4 +94,5 @@ class UpdaterTest extends TestCase
->method('fetchAll');
$this->updater->update();
}
+
} \ No newline at end of file
diff --git a/tests/command/update.bats b/tests/command/update.bats
new file mode 100644
index 000000000..d94c1cd28
--- /dev/null
+++ b/tests/command/update.bats
@@ -0,0 +1,21 @@
+#!/usr/bin/env bats
+
+# This only works with NC 26
+
+load "helpers/settings"
+load "../test_helper/bats-support/load"
+load "../test_helper/bats-assert/load"
+
+TESTSUITE="Update"
+
+@test "[$TESTSUITE] Job status" {
+ run ./occ news:updater:job
+
+ assert_success
+}
+
+@test "[$TESTSUITE] Job reset" {
+ run ./occ news:updater:job --reset
+
+ assert_success
+} \ No newline at end of file
diff --git a/tests/test_helper/bats-assert b/tests/test_helper/bats-assert
-Subproject 78fa631d1370562d2cd4a1390989e706158e7bf
+Subproject ffe84ea5dd43b568851549b3e241db150c12929