0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-02-28 18:43:44 +00:00
nextcloud_server/tests/lib/BackgroundJob/TestJob.php

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
814 B
PHP
Raw Normal View History

2014-02-12 12:52:13 +00:00
<?php
/**
* SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
* SPDX-License-Identifier: AGPL-3.0-or-later
2014-02-12 12:52:13 +00:00
*/
namespace Test\BackgroundJob;
use OCP\AppFramework\Utility\ITimeFactory;
class TestJob extends \OCP\BackgroundJob\Job {
2014-02-12 12:52:13 +00:00
private $testCase;
/**
* @var callable $callback
*/
private $callback;
/**
* @param JobTest $testCase
2014-02-12 12:52:13 +00:00
* @param callable $callback
*/
public function __construct(?ITimeFactory $time = null, $testCase = null, $callback = null) {
parent::__construct($time ?? \OCP\Server::get(ITimeFactory::class));
2014-02-12 12:52:13 +00:00
$this->testCase = $testCase;
$this->callback = $callback;
}
public function run($argument) {
$this->testCase->markRun();
$callback = $this->callback;
$callback($argument);
}
}