Skip to content

Commit 82c725e

Browse files
committed
test: Fix random test order pollution in EmailTest
1 parent e9dd608 commit 82c725e

1 file changed

Lines changed: 37 additions & 2 deletions

File tree

‎tests/system/Email/EmailTest.php‎

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,39 @@ final class EmailTest extends CIUnitTestCase
3131
{
3232
use ReflectionHelper;
3333

34+
protected function tearDown(): void
35+
{
36+
parent::tearDown();
37+
38+
global $mockMailCalled, $mockMailArgs, $mockMailException;
39+
global $mockPopenCalled, $mockPopenArgs, $mockPopenResult;
40+
global $mockPcloseStatus;
41+
global $mockFsockopenCalled, $mockFsockopenResult, $mockFsockopenArgs;
42+
global $mockFwriteCalled, $mockFwriteData;
43+
global $mockFgetsResponses, $mockFgetsException;
44+
global $mockCryptoResult;
45+
global $mockFopenFail;
46+
global $mockIconvUnavailable;
47+
48+
$mockMailCalled = null;
49+
$mockMailArgs = null;
50+
$mockMailException = null;
51+
$mockPopenCalled = null;
52+
$mockPopenArgs = null;
53+
$mockPopenResult = null;
54+
$mockPcloseStatus = null;
55+
$mockFsockopenCalled = null;
56+
$mockFsockopenResult = null;
57+
$mockFsockopenArgs = null;
58+
$mockFwriteCalled = null;
59+
$mockFwriteData = null;
60+
$mockFgetsResponses = null;
61+
$mockFgetsException = null;
62+
$mockCryptoResult = null;
63+
$mockFopenFail = null;
64+
$mockIconvUnavailable = null;
65+
}
66+
3467
public function testEmailValidation(): void
3568
{
3669
$config = config('Email');
@@ -1206,8 +1239,9 @@ public function testSendWithSmtpPlainAuthFailure(): void
12061239

12071240
public function testSendWithSmtpKeepAlive(): void
12081241
{
1209-
global $mockFsockopenCalled, $mockFgetsResponses, $mockFwriteData;
1242+
global $mockFsockopenCalled, $mockFgetsResponses, $mockFwriteData, $mockFwriteCalled;
12101243
$mockFsockopenCalled = false;
1244+
$mockFwriteCalled = false;
12111245
$mockFwriteData = [];
12121246

12131247
$mockFgetsResponses = [
@@ -1527,8 +1561,9 @@ public function testSendWithSmtpServerDisconnectsMidWay(): void
15271561

15281562
public function testSmtpSendsRcptToForCcAndBcc(): void
15291563
{
1530-
global $mockFsockopenCalled, $mockFgetsResponses, $mockFwriteData;
1564+
global $mockFsockopenCalled, $mockFgetsResponses, $mockFwriteData, $mockFwriteCalled;
15311565
$mockFsockopenCalled = false;
1566+
$mockFwriteCalled = false;
15321567
$mockFwriteData = [];
15331568

15341569
$mockFgetsResponses = [

0 commit comments

Comments
 (0)