aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2021-06-01 21:05:37 +0200
committerGitHub <noreply@github.com>2021-06-01 21:05:37 +0200
commit446c1c5adec9f19cbd5a26cb790acd367ef82da4 (patch)
treedeb63885a7b06b7b4573324b73b645db68d0cd02
parent09503b02694845fc519f19585e264a4a5fa8ed52 (diff)
parent22d35141f805a6b82f6ea7a3b67d5ec67713bdc2 (diff)
downloadnextcloud-server-446c1c5adec9f19cbd5a26cb790acd367ef82da4.tar.gz
nextcloud-server-446c1c5adec9f19cbd5a26cb790acd367ef82da4.zip
Merge pull request #27312 from francoisfreitag/tests-at
Rewrite birthday calendar tests without $this->at()
-rw-r--r--apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php10
-rw-r--r--apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php14
-rw-r--r--apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php6
3 files changed, 14 insertions, 16 deletions
diff --git a/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php b/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php
index 0e6e76d3927..2978863da88 100644
--- a/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php
+++ b/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php
@@ -82,7 +82,7 @@ class EnablePluginTest extends TestCase {
$plugin = new EnablePlugin($this->config, $this->birthdayService);
- $server->expects($this->at(0))
+ $server->expects($this->once())
->method('on')
->with('method:POST', [$plugin, 'httpPost']);
@@ -120,11 +120,11 @@ class EnablePluginTest extends TestCase {
->with('/bar/foo')
->willReturn($calendarHome);
- $this->request->expects($this->at(0))
+ $this->request->expects($this->once())
->method('getBodyAsString')
->willReturn('<nc:disable-birthday-calendar xmlns:nc="http://nextcloud.com/ns"/>');
- $this->request->expects($this->at(1))
+ $this->request->expects($this->once())
->method('getUrl')
->willReturn('url_abc');
@@ -158,11 +158,11 @@ class EnablePluginTest extends TestCase {
->method('getOwner')
->willReturn('principals/users/BlaBlub');
- $this->request->expects($this->at(0))
+ $this->request->expects($this->once())
->method('getBodyAsString')
->willReturn('<nc:enable-birthday-calendar xmlns:nc="http://nextcloud.com/ns"/>');
- $this->request->expects($this->at(1))
+ $this->request->expects($this->once())
->method('getUrl')
->willReturn('url_abc');
diff --git a/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php b/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php
index d1fc2c32f28..f017664238c 100644
--- a/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php
+++ b/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php
@@ -96,15 +96,13 @@ class BirthdayCalendarControllerTest extends TestCase {
$closure($user3);
});
- $this->jobList->expects($this->at(0))
+ $this->jobList->expects($this->exactly(3))
->method('add')
- ->with(GenerateBirthdayCalendarBackgroundJob::class, ['userId' => 'uid1']);
- $this->jobList->expects($this->at(1))
- ->method('add')
- ->with(GenerateBirthdayCalendarBackgroundJob::class, ['userId' => 'uid2']);
- $this->jobList->expects($this->at(2))
- ->method('add')
- ->with(GenerateBirthdayCalendarBackgroundJob::class, ['userId' => 'uid3']);
+ ->withConsecutive(
+ [GenerateBirthdayCalendarBackgroundJob::class, ['userId' => 'uid1']],
+ [GenerateBirthdayCalendarBackgroundJob::class, ['userId' => 'uid2']],
+ [GenerateBirthdayCalendarBackgroundJob::class, ['userId' => 'uid3']],
+ );
$response = $this->controller->enable();
$this->assertInstanceOf('OCP\AppFramework\Http\JSONResponse', $response);
diff --git a/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php b/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php
index 52c99fad2ee..639708c57ff 100644
--- a/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php
+++ b/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php
@@ -62,7 +62,7 @@ class RegenerateBirthdayCalendarsTest extends TestCase {
}
public function testRun() {
- $this->config->expects($this->at(0))
+ $this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'regeneratedBirthdayCalendarsForYearFix')
->willReturn(null);
@@ -72,11 +72,11 @@ class RegenerateBirthdayCalendarsTest extends TestCase {
->method('info')
->with('Adding background jobs to regenerate birthday calendar');
- $this->jobList->expects($this->at(0))
+ $this->jobList->expects($this->once())
->method('add')
->with(RegisterRegenerateBirthdayCalendars::class);
- $this->config->expects($this->at(1))
+ $this->config->expects($this->once())
->method('setAppValue')
->with('dav', 'regeneratedBirthdayCalendarsForYearFix', 'yes');