Fixed tests, applied StyleCI changes

This commit is contained in:
Dan Brown 2022-03-26 20:38:03 +00:00
parent 3625f12abe
commit b5281bc9ca
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
5 changed files with 17 additions and 14 deletions

View File

@ -118,6 +118,7 @@ class WebhookFormatter
{ {
$instance = new static($event, $webhook, $detail, $initiator, $initiatedTime); $instance = new static($event, $webhook, $detail, $initiator, $initiatedTime);
$instance->addDefaultModelFormatters(); $instance->addDefaultModelFormatters();
return $instance; return $instance;
} }
} }

View File

@ -338,7 +338,7 @@ class ImageService
* can be used (At least when created using binary string data) so we need to do some * can be used (At least when created using binary string data) so we need to do some
* implementation on our side to use the original image data. * implementation on our side to use the original image data.
* Bulk of logic taken from: https://github.com/Intervention/image/blob/b734a4988b2148e7d10364b0609978a88d277536/src/Intervention/Image/Commands/OrientateCommand.php * Bulk of logic taken from: https://github.com/Intervention/image/blob/b734a4988b2148e7d10364b0609978a88d277536/src/Intervention/Image/Commands/OrientateCommand.php
* Copyright (c) Oliver Vogel, MIT License * Copyright (c) Oliver Vogel, MIT License.
*/ */
protected function orientImageToOriginalExif(InterventionImage $image, string $originalData): void protected function orientImageToOriginalExif(InterventionImage $image, string $originalData): void
{ {
@ -347,7 +347,8 @@ class ImageService
} }
$stream = Utils::streamFor($originalData)->detach(); $stream = Utils::streamFor($originalData)->detach();
$orientation = exif_read_data($stream)['Orientation'] ?? null; $exif = @exif_read_data($stream);
$orientation = $exif ? ($exif['Orientation'] ?? null) : null;
switch ($orientation) { switch ($orientation) {
case 2: case 2:

View File

@ -47,6 +47,7 @@ class WebhookFormatTesting extends TestCase
$webhook = Webhook::factory()->make(); $webhook = Webhook::factory()->make();
$user = $this->getEditor(); $user = $this->getEditor();
$formatter = WebhookFormatter::getDefault($event, $webhook, $detail, $user, time()); $formatter = WebhookFormatter::getDefault($event, $webhook, $detail, $user, time());
return $formatter->format(); return $formatter->format();
} }
} }

View File

@ -186,7 +186,7 @@ class ThemeTest extends TestCase
dispatch((new DispatchWebhookJob($webhook, $event, $detail))); dispatch((new DispatchWebhookJob($webhook, $event, $detail)));
$this->assertCount(3, $args); $this->assertCount(5, $args);
$this->assertEquals($event, $args[0]); $this->assertEquals($event, $args[0]);
$this->assertEquals($webhook->id, $args[1]->id); $this->assertEquals($webhook->id, $args[1]->id);
$this->assertEquals($detail->id, $args[2]->id); $this->assertEquals($detail->id, $args[2]->id);