diff options
author | Morris Jobke <hey@morrisjobke.de> | 2019-05-24 15:55:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-24 15:55:23 +0200 |
commit | e7ae8511fb90a282c96a31bfb2b25ca0dfb6000a (patch) | |
tree | 639bd1b37db11214da349ee56daa1f2d24aff990 /apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php | |
parent | 5b0e70ff7753f41648758ade72cb24b82a513e6a (diff) | |
parent | 7ec8e6d35b2e0cd2417456772eb2708132460ce7 (diff) | |
download | nextcloud-server-e7ae8511fb90a282c96a31bfb2b25ca0dfb6000a.tar.gz nextcloud-server-e7ae8511fb90a282c96a31bfb2b25ca0dfb6000a.zip |
Merge pull request #15697 from nextcloud/bugfix/noid/calendar_birthday_move_repair_to_background
Don't run repair step for every individual user, outsource that to background job
Diffstat (limited to 'apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php')
-rw-r--r-- | apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php | 51 |
1 files changed, 7 insertions, 44 deletions
diff --git a/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php b/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php index 74af6af88dc..657d4dcebbb 100644 --- a/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php +++ b/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php @@ -22,39 +22,32 @@ namespace OCA\DAV\Tests\unit\DAV\Migration; -use OCA\DAV\BackgroundJob\GenerateBirthdayCalendarBackgroundJob; -use OCA\DAV\Migration\RefreshWebcalJobRegistrar; +use OCA\DAV\BackgroundJob\RegisterRegenerateBirthdayCalendars; use OCA\DAV\Migration\RegenerateBirthdayCalendars; use OCP\BackgroundJob\IJobList; use OCP\IConfig; -use OCP\IUser; -use OCP\IUserManager; use OCP\Migration\IOutput; use Test\TestCase; class RegenerateBirthdayCalendarsTest extends TestCase { - /** @var IUserManager | \PHPUnit_Framework_MockObject_MockObject */ - private $userManager; - /** @var IJobList | \PHPUnit_Framework_MockObject_MockObject */ private $jobList; /** @var IConfig | \PHPUnit_Framework_MockObject_MockObject */ private $config; - /** @var RefreshWebcalJobRegistrar */ + /** @var RegenerateBirthdayCalendars */ private $migration; protected function setUp() { parent::setUp(); - $this->userManager = $this->createMock(IUserManager::class); $this->jobList = $this->createMock(IJobList::class); $this->config = $this->createMock(IConfig::class); - $this->migration = new RegenerateBirthdayCalendars($this->userManager, - $this->jobList, $this->config); + $this->migration = new RegenerateBirthdayCalendars($this->jobList, + $this->config); } public function testGetName() { @@ -75,39 +68,9 @@ class RegenerateBirthdayCalendarsTest extends TestCase { ->method('info') ->with('Adding background jobs to regenerate birthday calendar'); - $this->userManager->expects($this->once()) - ->method('callForSeenUsers') - ->will($this->returnCallback(function($closure) { - $user1 = $this->createMock(IUser::class); - $user1->method('getUID')->will($this->returnValue('uid1')); - $user2 = $this->createMock(IUser::class); - $user2->method('getUID')->will($this->returnValue('uid2')); - $user3 = $this->createMock(IUser::class); - $user3->method('getUID')->will($this->returnValue('uid3')); - - $closure($user1); - $closure($user2); - $closure($user3); - })); - $this->jobList->expects($this->at(0)) ->method('add') - ->with(GenerateBirthdayCalendarBackgroundJob::class, [ - 'userId' => 'uid1', - 'purgeBeforeGenerating' => true - ]); - $this->jobList->expects($this->at(1)) - ->method('add') - ->with(GenerateBirthdayCalendarBackgroundJob::class, [ - 'userId' => 'uid2', - 'purgeBeforeGenerating' => true - ]); - $this->jobList->expects($this->at(2)) - ->method('add') - ->with(GenerateBirthdayCalendarBackgroundJob::class, [ - 'userId' => 'uid3', - 'purgeBeforeGenerating' => true - ]); + ->with(RegisterRegenerateBirthdayCalendars::class); $this->config->expects($this->at(1)) ->method('setAppValue') @@ -127,8 +90,8 @@ class RegenerateBirthdayCalendarsTest extends TestCase { ->method('info') ->with('Repair step already executed'); - $this->userManager->expects($this->never()) - ->method('callForSeenUsers'); + $this->jobList->expects($this->never()) + ->method('add'); $this->migration->run($output); } |