12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace Test\BackgroundJob;
- use OCP\AppFramework\Utility\ITimeFactory;
- class TestParallelAwareJob extends \OCP\BackgroundJob\Job {
- private $testCase;
-
- private $callback;
-
- public function __construct(?ITimeFactory $time = null, $testCase = null, $callback = null) {
- parent::__construct($time ?? \OC::$server->get(ITimeFactory::class));
- $this->setAllowParallelRuns(false);
- $this->testCase = $testCase;
- $this->callback = $callback;
- }
- public function run($argument) {
- $this->testCase->markRun();
- $callback = $this->callback;
- $callback($argument);
- }
- }
|