From fe2c286a3bda00061dbb0b430f22eb24cf9ba9bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 27 Oct 2021 14:58:44 +0200 Subject: [PATCH] Fix tests after merge of multiple email addresses on server MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- tests/unit/UserBackendTest.php | 45 +++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/tests/unit/UserBackendTest.php b/tests/unit/UserBackendTest.php index 6325091aa..3bc4f50a4 100644 --- a/tests/unit/UserBackendTest.php +++ b/tests/unit/UserBackendTest.php @@ -117,10 +117,17 @@ public function testUpdateAttributesWithoutAttributes() { ->method('get') ->with('ExistingUser') ->willReturn($user); - $user - ->expects($this->once()) - ->method('getEMailAddress') - ->willReturn(null); + if (method_exists($user, 'getSystemEMailAddress')) { + $user + ->expects($this->once()) + ->method('getSystemEMailAddress') + ->willReturn(null); + } else { + $user + ->expects($this->once()) + ->method('getEMailAddress') + ->willReturn(null); + } $user ->expects($this->never()) ->method('setEMailAddress'); @@ -175,10 +182,17 @@ public function testUpdateAttributes() { ->method('get') ->with('ExistingUser') ->willReturn($user); - $user - ->expects($this->once()) - ->method('getEMailAddress') - ->willReturn('old@example.com'); + if (method_exists($user, 'getSystemEMailAddress')) { + $user + ->expects($this->once()) + ->method('getSystemEMailAddress') + ->willReturn('old@example.com'); + } else { + $user + ->expects($this->once()) + ->method('getEMailAddress') + ->willReturn('old@example.com'); + } $user ->expects($this->once()) ->method('setEMailAddress') @@ -263,10 +277,17 @@ public function testUpdateAttributesQuotaDefaultFallback() { ->method('get') ->with('ExistingUser') ->willReturn($user); - $user - ->expects($this->once()) - ->method('getEMailAddress') - ->willReturn('old@example.com'); + if (method_exists($user, 'getSystemEMailAddress')) { + $user + ->expects($this->once()) + ->method('getSystemEMailAddress') + ->willReturn('old@example.com'); + } else { + $user + ->expects($this->once()) + ->method('getEMailAddress') + ->willReturn('old@example.com'); + } $user ->expects($this->once()) ->method('setEMailAddress')