1
0

testjob.php 675 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. namespace Test\BackgroundJob;
  9. class TestJob extends \OC\BackgroundJob\Job {
  10. private $testCase;
  11. /**
  12. * @var callable $callback
  13. */
  14. private $callback;
  15. /**
  16. * @param Job $testCase
  17. * @param callable $callback
  18. */
  19. public function __construct($testCase = null, $callback = null) {
  20. $this->testCase = $testCase;
  21. $this->callback = $callback;
  22. }
  23. public function run($argument) {
  24. $this->testCase->markRun();
  25. $callback = $this->callback;
  26. $callback($argument);
  27. }
  28. }