1
0

BackgroundJobsTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2023 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2015 Christian Kampka <christian@kampka.net>
  5. * SPDX-License-Identifier: MIT
  6. */
  7. namespace Test\Command;
  8. use OC\Core\Command\Background\Ajax;
  9. use OC\Core\Command\Background\Cron;
  10. use OC\Core\Command\Background\WebCron;
  11. use Symfony\Component\Console\Input\StringInput;
  12. use Symfony\Component\Console\Output\NullOutput;
  13. use Test\TestCase;
  14. class BackgroundJobsTest extends TestCase {
  15. public function testCronCommand() {
  16. $config = \OC::$server->getConfig();
  17. $job = new Cron($config);
  18. $job->run(new StringInput(''), new NullOutput());
  19. $this->assertEquals('cron', $config->getAppValue('core', 'backgroundjobs_mode'));
  20. }
  21. public function testAjaxCommand() {
  22. $config = \OC::$server->getConfig();
  23. $job = new Ajax($config);
  24. $job->run(new StringInput(''), new NullOutput());
  25. $this->assertEquals('ajax', $config->getAppValue('core', 'backgroundjobs_mode'));
  26. }
  27. public function testWebCronCommand() {
  28. $config = \OC::$server->getConfig();
  29. $job = new WebCron($config);
  30. $job->run(new StringInput(''), new NullOutput());
  31. $this->assertEquals('webcron', $config->getAppValue('core', 'backgroundjobs_mode'));
  32. }
  33. }