0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-02-23 00:19:14 +00:00
nextcloud_server/tests/lib/BackgroundJob/TestJob.php
Côme Chilliet 0b332ceac2 fix: Apply new coding standard to all files
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-04-04 11:45:22 +02:00

36 lines
822 B
PHP

<?php
/**
* Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace Test\BackgroundJob;
use OCP\AppFramework\Utility\ITimeFactory;
class TestJob extends \OCP\BackgroundJob\Job {
private $testCase;
/**
* @var callable $callback
*/
private $callback;
/**
* @param JobTest $testCase
* @param callable $callback
*/
public function __construct(?ITimeFactory $time = null, $testCase = null, $callback = null) {
parent::__construct($time ?? \OCP\Server::get(ITimeFactory::class));
$this->testCase = $testCase;
$this->callback = $callback;
}
public function run($argument) {
$this->testCase->markRun();
$callback = $this->callback;
$callback($argument);
}
}