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.

DropOldJobsTest.php 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Copyright (c) 2015 Arthur Schiwon <blizzz@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\Repair;
  9. use OCP\BackgroundJob\IJobList;
  10. use OCP\Migration\IOutput;
  11. /**
  12. * Tests for the dropping old tables
  13. *
  14. * @group DB
  15. *
  16. * @see \OC\Repair\DropOldTables
  17. */
  18. class DropOldJobsTest extends \Test\TestCase {
  19. /** @var IJobList */
  20. protected $jobList;
  21. protected function setUp() {
  22. parent::setUp();
  23. $this->jobList = \OC::$server->getJobList();
  24. $this->jobList->add('OC\Cache\FileGlobalGC');
  25. $this->jobList->add('OC_Cache_FileGlobalGC');
  26. }
  27. public function testRun() {
  28. $this->assertTrue($this->jobList->has('OC\Cache\FileGlobalGC', null), 'Asserting that the job OC\Cache\FileGlobalGC exists before repairing');
  29. $this->assertTrue($this->jobList->has('OC_Cache_FileGlobalGC', null), 'Asserting that the job OC_Cache_FileGlobalGC exists before repairing');
  30. /** @var IOutput | \PHPUnit_Framework_MockObject_MockObject $outputMock */
  31. $outputMock = $this->getMockBuilder('\OCP\Migration\IOutput')
  32. ->disableOriginalConstructor()
  33. ->getMock();
  34. $repair = new \OC\Repair\DropOldJobs($this->jobList);
  35. $repair->run($outputMock);
  36. $this->assertFalse($this->jobList->has('OC\Cache\FileGlobalGC', null), 'Asserting that the job OC\Cache\FileGlobalGC does not exist after repairing');
  37. $this->assertFalse($this->jobList->has('OC_Cache_FileGlobalGC', null), 'Asserting that the job OC_Cache_FileGlobalGC does not exist after repairing');
  38. }
  39. }