TestJob.php 678 B

123456789101112131415161718192021222324252627282930313233
  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 JobTest $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. }