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

Commit 8834f56

Browse files
committed
Merge branch 'release/0.0.4'
2 parents 88444f1 + 2be8fe2 commit 8834f56

File tree

4 files changed

+30
-16
lines changed

4 files changed

+30
-16
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.3
1+
0.0.4

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ You mixin the assertions with the ```Spinen\MailAssertions\MailTracking``` trait
3636
* seeEmailEquals
3737
* seeEmailFrom
3838
* seeEmailReplyTo
39-
* seeEmailSubject
4039
* seeEmailSubjectContains
4140
* seeEmailSubjectDoesNotContain
41+
* seeEmailSubjectEquals
4242
* seeEmailTo
4343
* seeEmailWasNotSent
4444
* seeEmailWasSent

src/MailTracking.php

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,11 @@ protected function seeEmailsSent($count)
224224
* @param Swift_Message|null $message
225225
*
226226
* @return PHPUnit_Framework_TestCase $this
227+
* @deprecated in favor of seeEmailSubjectEquals
227228
*/
228229
protected function seeEmailSubject($subject, Swift_Message $message = null)
229230
{
230-
$this->assertEquals($subject, $this->getEmail($message)
231-
->getSubject(),
232-
"The last email sent did not contain a subject of $subject.");
233-
234-
return $this;
231+
return $this->seeEmailSubjectEquals($subject, $message);
235232
}
236233

237234
/**
@@ -268,6 +265,23 @@ protected function seeEmailSubjectDoesNotContain($excerpt, Swift_Message $messag
268265
return $this;
269266
}
270267

268+
/**
269+
* Assert that the last email's subject matches the given string.
270+
*
271+
* @param string $subject
272+
* @param Swift_Message|null $message
273+
*
274+
* @return PHPUnit_Framework_TestCase $this
275+
*/
276+
protected function seeEmailSubjectEquals($subject, Swift_Message $message = null)
277+
{
278+
$this->assertEquals($subject, $this->getEmail($message)
279+
->getSubject(),
280+
"The last email sent did not contain a subject of $subject.");
281+
282+
return $this;
283+
}
284+
271285
/**
272286
* Assert that the last email was sent to the given recipient.
273287
*

tests/MailTrackingTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -242,38 +242,38 @@ public function it_knows_how_many_emails_have_been_sent()
242242
* @test
243243
* @group unit
244244
*/
245-
public function it_makes_sure_email_subject_is_what_is_expected()
245+
public function it_makes_sure_email_subject_contains_expected_string()
246246
{
247247
$message = $this->makeMessage('full message subject');
248248
$this->mail_tracking->recordMail($message);
249249

250250
$this->assertEquals($this->mail_tracking,
251-
$this->callProtectedMethod('seeEmailSubject', ['full message subject']));
251+
$this->callProtectedMethod('seeEmailSubjectContains', ['subject']));
252252
}
253253

254254
/**
255255
* @test
256256
* @group unit
257257
*/
258-
public function it_makes_sure_email_subject_contains_expected_string()
258+
public function it_makes_sure_email_subject_does_not_contain_string()
259259
{
260-
$message = $this->makeMessage('full message subject');
260+
$message = $this->makeMessage('');
261261
$this->mail_tracking->recordMail($message);
262262

263-
$this->assertEquals($this->mail_tracking,
264-
$this->callProtectedMethod('seeEmailSubjectContains', ['subject']));
263+
$this->assertEquals($this->mail_tracking, $this->callProtectedMethod('seeEmailSubjectDoesNotContain', ['subject']));
265264
}
266265

267266
/**
268267
* @test
269268
* @group unit
270269
*/
271-
public function it_makes_sure_email_subject_does_not_contain_string()
270+
public function it_makes_sure_email_subject_is_what_is_expected()
272271
{
273-
$message = $this->makeMessage('');
272+
$message = $this->makeMessage('full message subject');
274273
$this->mail_tracking->recordMail($message);
275274

276-
$this->assertEquals($this->mail_tracking, $this->callProtectedMethod('seeEmailSubjectDoesNotContain', ['subject']));
275+
$this->assertEquals($this->mail_tracking,
276+
$this->callProtectedMethod('seeEmailSubjectEquals', ['full message subject']));
277277
}
278278

279279
/**

0 commit comments

Comments
 (0)