You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

job.php 747B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * Copyright (c) 2013 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 Job extends \Test\TestCase {
  10. private $run = false;
  11. protected function setUp() {
  12. parent::setUp();
  13. $this->run = false;
  14. }
  15. public function testRemoveAfterException() {
  16. $jobList = new DummyJobList();
  17. $job = new TestJob($this, function () {
  18. throw new \Exception();
  19. });
  20. $jobList->add($job);
  21. $this->assertCount(1, $jobList->getAll());
  22. $job->execute($jobList);
  23. $this->assertTrue($this->run);
  24. $this->assertCount(0, $jobList->getAll());
  25. }
  26. public function markRun() {
  27. $this->run = true;
  28. }
  29. }