From 8ece6e064df396db08b678f42483987e917f63b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Thu, 15 Jul 2021 09:19:38 +0200 Subject: Replace any string value with a nullable network for the fallback to match the first social service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- tests/unit/Service/SocialApiServiceTest.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'tests/unit/Service/SocialApiServiceTest.php') diff --git a/tests/unit/Service/SocialApiServiceTest.php b/tests/unit/Service/SocialApiServiceTest.php index 9c2ab925..675f81f6 100644 --- a/tests/unit/Service/SocialApiServiceTest.php +++ b/tests/unit/Service/SocialApiServiceTest.php @@ -237,7 +237,7 @@ class SocialApiServiceTest extends TestCase { 'VERSION' => $contact['VERSION'], 'PHOTO;ENCODING=b;TYPE=' . $imageType . ';VALUE=BINARY' => base64_encode($body) ]; - + $this->socialProvider ->expects($this->once())->method("getSocialConnector")->with($network); $provider->expects($this->once())->method("supportsContact")->with($contact); @@ -306,7 +306,7 @@ class SocialApiServiceTest extends TestCase { 'VERSION' => $contact['VERSION'], 'PHOTO' => "data:".$imageType.";base64," . base64_encode($body) ]; - + $this->socialProvider ->expects($this->once())->method("getSocialConnector")->with($network); $provider->expects($this->once())->method("supportsContact")->with($contact); @@ -442,7 +442,17 @@ class SocialApiServiceTest extends TestCase { $this->setupAddressbooks(); - $result = $this->service->updateAddressbooks('any', 'mrstest'); + if ($syncAllowedByAdmin === 'yes' && $bgSyncEnabledByUser === 'yes') { + $this->socialProvider + ->expects($this->atLeastOnce()) + ->method('getSocialConnectors'); + } + + $this->socialProvider + ->expects($this->never()) + ->method('getSocialConnector'); + + $result = $this->service->updateAddressbooks('mrstest'); $this->assertEquals($expected, $result->getStatus()); @@ -474,7 +484,7 @@ class SocialApiServiceTest extends TestCase { $this->setupAddressbooks(); - $result = $this->service->updateAddressbooks('any', 'msstest'); + $result = $this->service->updateAddressbooks('msstest'); $this->assertEquals(Http::STATUS_PARTIAL_CONTENT, $result->getStatus()); @@ -502,7 +512,7 @@ class SocialApiServiceTest extends TestCase { $this->setupAddressbooks(); - $result = $this->service->updateAddressbooks('any', 'mrstest', 'contacts2', '22222222-2222-2222-2222-222222222222'); + $result = $this->service->updateAddressbooks('mrstest', 'contacts2', '22222222-2222-2222-2222-222222222222'); $this->assertEquals($expected, $result->getStatus()); -- cgit v1.2.3