summaryrefslogtreecommitdiffstats
path: root/tests/unit/Service/SocialApiServiceTest.php
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2022-05-16 19:45:17 +0200
committerThomas Citharel <tcit@tcit.fr>2022-05-16 20:10:27 +0200
commitb6dd2e3318f869f5abad1bcbce7458f2ae2a1c59 (patch)
treebbc7ff8aeea8c17c204667823f77bd55103bc9bf /tests/unit/Service/SocialApiServiceTest.php
parent938bf0ca100b110176cfff1fe3a1a34555e3b811 (diff)
Resize maximum dimensions for pictures coming from SocialApiService
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'tests/unit/Service/SocialApiServiceTest.php')
-rw-r--r--tests/unit/Service/SocialApiServiceTest.php29
1 files changed, 24 insertions, 5 deletions
diff --git a/tests/unit/Service/SocialApiServiceTest.php b/tests/unit/Service/SocialApiServiceTest.php
index cd7e1e43..622610a4 100644
--- a/tests/unit/Service/SocialApiServiceTest.php
+++ b/tests/unit/Service/SocialApiServiceTest.php
@@ -62,6 +62,8 @@ class SocialApiServiceTest extends TestCase {
private $davBackend;
/** @var ITimeFactory|MockObject */
private $timeFactory;
+ /** @var ImageResizer|MockObject */
+ private $imageResizer;
public function allSocialProfileProviders(): array {
$body = "the body";
@@ -127,6 +129,7 @@ class SocialApiServiceTest extends TestCase {
$this->urlGen = $this->createMock(IURLGenerator::class);
$this->davBackend = $this->createMock(CardDavBackend::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
+ $this->imageResizer = $this->createMock(ImageResizer::class);
$this->service = new SocialApiService(
$this->socialProvider,
$this->manager,
@@ -135,7 +138,8 @@ class SocialApiServiceTest extends TestCase {
$this->l10n,
$this->urlGen,
$this->davBackend,
- $this->timeFactory
+ $this->timeFactory,
+ $this->imageResizer
);
}
@@ -174,12 +178,16 @@ class SocialApiServiceTest extends TestCase {
$this->clientService
->method('NewClient')
->willReturn($client);
+ $this->imageResizer
+ ->expects($body ? $this->once() : $this->never())
+ ->method('resizeImage')
+ ->willReturn($body);
$result = $this->service
- ->updateContact(
- 'contacts',
- '3225c0d5-1bd2-43e5-a08c-4e65eaa406b0',
- null);
+ ->updateContact(
+ 'contacts',
+ '3225c0d5-1bd2-43e5-a08c-4e65eaa406b0',
+ null);
$this->assertEquals($status, $result->getStatus());
}
@@ -231,6 +239,10 @@ class SocialApiServiceTest extends TestCase {
$this->clientService
->method('NewClient')
->willReturn($client);
+ $this->imageResizer
+ ->expects($this->once())
+ ->method('resizeImage')
+ ->willReturn($body);
$changes = [
'URI' => $contact['URI'],
@@ -300,6 +312,10 @@ class SocialApiServiceTest extends TestCase {
$this->clientService
->method('NewClient')
->willReturn($client);
+ $this->imageResizer
+ ->expects($this->once())
+ ->method('resizeImage')
+ ->willReturn($body);
$changes = [
'URI' => $contact['URI'],
@@ -424,6 +440,9 @@ class SocialApiServiceTest extends TestCase {
$this->clientService
->method('NewClient')
->willReturn($client);
+ $this->imageResizer
+ ->method('resizeImage')
+ ->willReturn('someBody');
}
/**