aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Command/BackgroundJobsTest.php
blob: 310f1057bb4d574118e7de88a04a8cc990ca5c42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/**
 * SPDX-FileCopyrightText: 2016-2023 Nextcloud GmbH and Nextcloud contributors
 * SPDX-FileCopyrightText: 2015 Christian Kampka <christian@kampka.net>
 * SPDX-License-Identifier: MIT
 */
namespace Test\Command;

use OC\Core\Command\Background\Ajax;
use OC\Core\Command\Background\Cron;
use OC\Core\Command\Background\WebCron;

use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\NullOutput;
use Test\TestCase;

class BackgroundJobsTest extends TestCase {
	public function testCronCommand() {
		$config = \OC::$server->getConfig();
		$job = new Cron($config);
		$job->run(new StringInput(''), new NullOutput());
		$this->assertEquals('cron', $config->getAppValue('core', 'backgroundjobs_mode'));
	}

	public function testAjaxCommand() {
		$config = \OC::$server->getConfig();
		$job = new Ajax($config);
		$job->run(new StringInput(''), new NullOutput());
		$this->assertEquals('ajax', $config->getAppValue('core', 'backgroundjobs_mode'));
	}

	public function testWebCronCommand() {
		$config = \OC::$server->getConfig();
		$job = new WebCron($config);
		$job->run(new StringInput(''), new NullOutput());
		$this->assertEquals('webcron', $config->getAppValue('core', 'backgroundjobs_mode'));
	}
}