Skip to content

Commit 4227967

Browse files
committed
Don't refresh fax for exception messaging
1 parent 26e4442 commit 4227967

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/InterfaxChannel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ public function send($notifiable, Notification $notification)
4646
}
4747

4848
if ($this->fax->refresh()->status > 0) {
49-
throw CouldNotSendNotification::serviceRespondedWithAnError($message, $this->fax->refresh()->attributes());
49+
throw CouldNotSendNotification::serviceRespondedWithAnError($message, $this->fax->attributes());
5050
}
5151
}
5252
} catch (\Interfax\Exception\RequestException $e) {
5353
$exceptionMessage = $e->getMessage().': '.($e->getWrappedException())->getMessage();
54-
$attributes = $this->fax ? $this->fax->refresh()->attributes() : ['status' => $e->getStatusCode()];
54+
$attributes = $this->fax ? $this->fax->attributes() : ['status' => $e->getStatusCode()];
5555

5656
throw CouldNotSendNotification::serviceRespondedWithAnError($message, $attributes, $exceptionMessage);
5757
}

tests/InterfaxChannelTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,15 @@ public function it_can_throw_the_exception()
152152
{
153153
$this->expectException(CouldNotSendNotification::class);
154154

155+
$testResource = new TestResource;
156+
155157
$this->resource
156158
->shouldReceive('refresh')
157-
->andReturn(new TestResource);
159+
->andReturn($testResource);
160+
161+
$this->resource
162+
->shouldReceive('attributes')
163+
->andReturn($testResource->attributes());
158164

159165
$this->interfax
160166
->shouldReceive('deliver')

0 commit comments

Comments
 (0)