/** * @param string $message * * @throws NotificationExpectationMismatchException */ public function checkSuccessNotificationMessage($message) { if ($this->notificationAccessor->hasSuccessMessage() && $this->notificationAccessor->hasMessage($message)) { return; } throw new NotificationExpectationMismatchException('success', $message, $this->notificationAccessor->getMessageType(), $this->notificationAccessor->getMessage()); }
function it_throws_notification_mismatch_exception_if_diffrent_message_type_has_been_found(NotificationAccessorInterface $notificationAccessor) { $notificationAccessor->hasSuccessMessage()->willReturn(false); $notificationAccessor->hasMessage('Some resource has been successfully created.')->willReturn(false); $notificationAccessor->getMessageType()->willReturn('failure'); $notificationAccessor->getMessage()->willReturn('Some resource has been successfully created.'); $this->shouldThrow(new NotificationExpectationMismatchException('success', 'Some resource has been successfully created.', 'failure', 'Some resource has been successfully created.'))->during('checkSuccessNotificationMessage', ['Some resource has been successfully created.']); }