Skip to content

Commit cac3e74

Browse files
committed
Added assertContains deprecation coverage if using phpunit < 8.0
1 parent a5020c9 commit cac3e74

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

CHANGELOG.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,20 @@
22

33
All notable changes to `mail-intercept` will be documented in this file
44

5-
## 0.1.0 - 2019-12-06
5+
## 0.2.2 - 2020-03-11
66

7-
- Initial release
7+
- Added coverage for string assertion deprecations if using PHPUnit < 8.0
8+
9+
## 0.2.1 - 2020-03-11
10+
11+
- Fixed composer install command
812

913
## 0.2.0 - 2020-02-06
1014

1115
- Added new assertions for sender, cc, bcc, content type, and reply to
1216
- Refactored to, from, and subject to use different getters
1317
- Update readme to include new assertions
18+
19+
## 0.1.0 - 2019-12-06
20+
21+
- Initial release

src/Assertions/ContentAssertions.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,30 @@ trait ContentAssertions
1414
*/
1515
public function assertMailBodyContainsString(string $needle, Swift_Message $mail)
1616
{
17-
$this->assertStringContainsString(
17+
$method = method_exists($this, 'assertStringContainsString')
18+
? 'assertStringContainsString'
19+
: 'assertContains';
20+
21+
$this->{$method}(
1822
$needle,
1923
$mail->getBody(),
2024
"The expected [{$needle}] string was not found in the body."
2125
);
2226
}
2327

2428
/**
25-
* Assert mail body contains string.
29+
* Assert mail body does not contain string.
2630
*
2731
* @param string $needle
2832
* @param Swift_Message $mail
2933
*/
3034
public function assertMailBodyNotContainsString(string $needle, Swift_Message $mail)
3135
{
32-
$this->assertStringNotContainsString(
36+
$method = method_exists($this, 'assertStringNotContainsString')
37+
? 'assertStringNotContainsString'
38+
: 'assertNotContains';
39+
40+
$this->{$method}(
3341
$needle,
3442
$mail->getBody(),
3543
"The expected [{$needle}] string was found in the body."

0 commit comments

Comments
 (0)