Skip to content
This repository was archived by the owner on Apr 8, 2024. It is now read-only.

Commit 6b11665

Browse files
committed
Update assertion messaging
1 parent a9453c2 commit 6b11665

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/MailTracking.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function recordMail(Swift_Message $email)
9797
protected function seeEmailBcc($bcc, Swift_Message $message = null)
9898
{
9999
$this->assertArrayHasKey($bcc, (array)$this->getEmail($message)
100-
->getBcc(), "No email was bcc'ed to $bcc.");
100+
->getBcc(), "The last email sent was not bcc'ed to $bcc.");
101101

102102
return $this;
103103
}
@@ -113,7 +113,7 @@ protected function seeEmailBcc($bcc, Swift_Message $message = null)
113113
protected function seeEmailCc($cc, Swift_Message $message = null)
114114
{
115115
$this->assertArrayHasKey($cc, (array)$this->getEmail($message)
116-
->getCc(), "No email was cc'ed to $cc.");
116+
->getCc(), "The last email sent was not cc'ed to $cc.");
117117

118118
return $this;
119119
}
@@ -129,7 +129,7 @@ protected function seeEmailCc($cc, Swift_Message $message = null)
129129
protected function seeEmailContains($excerpt, Swift_Message $message = null)
130130
{
131131
$this->assertContains($excerpt, $this->getEmail($message)
132-
->getBody(), "No email containing the provided body was found.");
132+
->getBody(), "The last email sent did not contain the provided body.");
133133

134134
return $this;
135135
}
@@ -145,7 +145,7 @@ protected function seeEmailContains($excerpt, Swift_Message $message = null)
145145
protected function seeEmailDoesNotContain($excerpt, Swift_Message $message = null)
146146
{
147147
$this->assertNotContains($excerpt, $this->getEmail($message)
148-
->getBody(), "Email containing the provided text was found in the body.");
148+
->getBody(), "The last email sent contained the provided text in its body.");
149149

150150
return $this;
151151
}
@@ -161,7 +161,7 @@ protected function seeEmailDoesNotContain($excerpt, Swift_Message $message = nul
161161
protected function seeEmailEquals($body, Swift_Message $message = null)
162162
{
163163
$this->assertEquals($body, $this->getEmail($message)
164-
->getBody(), "No email with the provided body was sent.");
164+
->getBody(), "The last email sent did not match the given email.");
165165

166166
return $this;
167167
}
@@ -178,7 +178,7 @@ protected function seeEmailFrom($sender, Swift_Message $message = null)
178178
{
179179
// TODO: Allow from to be an array to check email & name
180180
$this->assertArrayHasKey($sender, (array)$this->getEmail($message)
181-
->getFrom(), "No email was sent from $sender.");
181+
->getFrom(), "The last email sent was not sent from $sender.");
182182

183183
return $this;
184184
}
@@ -194,7 +194,7 @@ protected function seeEmailFrom($sender, Swift_Message $message = null)
194194
protected function seeEmailReplyTo($reply_to, Swift_Message $message = null)
195195
{
196196
$this->assertArrayHasKey($reply_to, (array)$this->getEmail($message)
197-
->getReplyTo(), "No email was set to reply to $reply_to.");
197+
->getReplyTo(), "The last email sent was not set to reply to $reply_to.");
198198

199199
return $this;
200200
}
@@ -227,7 +227,7 @@ protected function seeEmailSubject($subject, Swift_Message $message = null)
227227
{
228228
// TODO: Consider a subject contains like the message contains
229229
$this->assertEquals($subject, $this->getEmail($message)
230-
->getSubject(), "No email with a subject of $subject was found.");
230+
->getSubject(), "The last email sent did not contain a subject of $subject.");
231231

232232
return $this;
233233
}
@@ -243,7 +243,7 @@ protected function seeEmailSubject($subject, Swift_Message $message = null)
243243
protected function seeEmailTo($recipient, Swift_Message $message = null)
244244
{
245245
$this->assertArrayHasKey($recipient, (array)$this->getEmail($message)
246-
->getTo(), "No email was sent to $recipient.");
246+
->getTo(), "The last email sent was not sent to $recipient.");
247247

248248
return $this;
249249
}
@@ -255,7 +255,7 @@ protected function seeEmailTo($recipient, Swift_Message $message = null)
255255
*/
256256
protected function seeEmailWasNotSent()
257257
{
258-
$this->assertEmpty($this->emails, 'Did not expect any emails to have been sent.');
258+
$this->assertEmpty($this->emails, 'Did not expect any emails to have been sent, but found '.count($this->emails).'.');
259259

260260
return $this;
261261
}
@@ -267,7 +267,7 @@ protected function seeEmailWasNotSent()
267267
*/
268268
protected function seeEmailWasSent()
269269
{
270-
$this->assertNotEmpty($this->emails, 'No emails have been sent.');
270+
$this->assertNotEmpty($this->emails, 'Expected at least one email to be sent, but found none.');
271271

272272
return $this;
273273
}

0 commit comments

Comments
 (0)