1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
|
From: Joe Nahmias <jello@debian.org>
Date: Thu, 11 Sep 2025 22:36:05 -0400
Subject: do not use addToAssertionCount() in empty tests
label tests that do not make assertions appropriately
or mark them as incomplete if empty
---
tests/acceptance/Swift/DependencyContainerAcceptanceTest.php | 5 +++--
.../Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php | 6 ++++++
tests/bug/Swift/Bug274Test.php | 4 +++-
tests/unit/Swift/MessageTest.php | 4 ----
tests/unit/Swift/Mime/EmbeddedFileTest.php | 5 +++--
tests/unit/Swift/Mime/SimpleMessageTest.php | 5 +++--
tests/unit/Swift/Signers/OpenDKIMSignerTest.php | 6 ++++++
tests/unit/Swift/Transport/EsmtpTransportTest.php | 5 +++--
8 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php b/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php
index 3c1b515..9c488e9 100644
--- a/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php
+++ b/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php
@@ -6,6 +6,9 @@ require_once 'swift_required.php';
class Swift_DependencyContainerAcceptanceTest extends PHPUnit\Framework\TestCase
{
+ /**
+ * @doesNotPerformAssertions
+ */
public function testNoLookupsFail()
{
$di = Swift_DependencyContainer::getInstance();
@@ -16,7 +19,5 @@ class Swift_DependencyContainerAcceptanceTest extends PHPUnit\Framework\TestCase
$this->fail($e->getMessage());
}
}
- // previous loop would fail if there is an issue
- $this->addToAssertionCount(1);
}
}
diff --git a/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php b/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php
index 68ad21e..4c120c3 100644
--- a/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php
+++ b/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php
@@ -16,6 +16,9 @@ class Swift_Transport_StreamBuffer_ProcessAcceptanceTest extends Swift_Transport
parent::setUp();
}
+ /**
+ * @doesNotPerformAssertions
+ */
public function testReadLine()
{
if (true == getenv('GITHUB_ACTIONS')) {
@@ -25,6 +28,9 @@ class Swift_Transport_StreamBuffer_ProcessAcceptanceTest extends Swift_Transport
}
}
+ /**
+ * @doesNotPerformAssertions
+ */
public function testWrite()
{
if (true == getenv('GITHUB_ACTIONS')) {
diff --git a/tests/bug/Swift/Bug274Test.php b/tests/bug/Swift/Bug274Test.php
index 9fff072..ea70312 100644
--- a/tests/bug/Swift/Bug274Test.php
+++ b/tests/bug/Swift/Bug274Test.php
@@ -11,6 +11,9 @@ class Swift_Bug274Test extends \PHPUnit\Framework\TestCase
$message->attach(Swift_Attachment::fromPath(''));
}
+ /**
+ * @doesNotPerformAssertions
+ */
public function testNonEmptyFileNameAsAttachment()
{
$message = new Swift_Message();
@@ -19,6 +22,5 @@ class Swift_Bug274Test extends \PHPUnit\Framework\TestCase
} catch (Exception $e) {
$this->fail('Path should not be empty');
}
- $this->addToAssertionCount(1);
}
}
diff --git a/tests/unit/Swift/MessageTest.php b/tests/unit/Swift/MessageTest.php
index 1c3f894..7b2d3cc 100644
--- a/tests/unit/Swift/MessageTest.php
+++ b/tests/unit/Swift/MessageTest.php
@@ -9,8 +9,6 @@ class Swift_MessageTest extends \PHPUnit\Framework\TestCase
$message1_clone = clone $message1;
$this->recursiveObjectCloningCheck($message1, $message2, $message1_clone);
- // the test above will fail if the two messages are not identical
- $this->addToAssertionCount(1);
}
public function testCloningWithSigners()
@@ -24,8 +22,6 @@ class Swift_MessageTest extends \PHPUnit\Framework\TestCase
$message1_clone = clone $message1;
$this->recursiveObjectCloningCheck($message1, $message2, $message1_clone);
- // the test above will fail if the two messages are not identical
- $this->addToAssertionCount(1);
}
public function testBodySwap()
diff --git a/tests/unit/Swift/Mime/EmbeddedFileTest.php b/tests/unit/Swift/Mime/EmbeddedFileTest.php
index 5476fad..88d80c4 100644
--- a/tests/unit/Swift/Mime/EmbeddedFileTest.php
+++ b/tests/unit/Swift/Mime/EmbeddedFileTest.php
@@ -2,10 +2,11 @@
class Swift_Mime_EmbeddedFileTest extends Swift_Mime_AttachmentTest
{
+ /**
+ * @doesNotPerformAssertions
+ */
public function testNestingLevelIsAttachment()
{
- // previous loop would fail if there is an issue
- $this->addToAssertionCount(1);
}
public function testNestingLevelIsEmbedded()
diff --git a/tests/unit/Swift/Mime/SimpleMessageTest.php b/tests/unit/Swift/Mime/SimpleMessageTest.php
index 1b6687a..da4edac 100644
--- a/tests/unit/Swift/Mime/SimpleMessageTest.php
+++ b/tests/unit/Swift/Mime/SimpleMessageTest.php
@@ -2,10 +2,11 @@
class Swift_Mime_SimpleMessageTest extends Swift_Mime_MimePartTest
{
+ /**
+ * @doesNotPerformAssertions
+ */
public function testNestingLevelIsSubpart()
{
- // not relevant
- $this->addToAssertionCount(1);
}
public function testNestingLevelIsTop()
diff --git a/tests/unit/Swift/Signers/OpenDKIMSignerTest.php b/tests/unit/Swift/Signers/OpenDKIMSignerTest.php
index 894a433..88cada5 100644
--- a/tests/unit/Swift/Signers/OpenDKIMSignerTest.php
+++ b/tests/unit/Swift/Signers/OpenDKIMSignerTest.php
@@ -16,30 +16,36 @@ class Swift_Signers_OpenDKIMSignerTest extends \SwiftMailerTestCase
public function testBasicSigningHeaderManipulation()
{
+ $this->markTestIncomplete('This test has not been implemented yet.');
}
// Default Signing
public function testSigningDefaults()
{
+ $this->markTestIncomplete('This test has not been implemented yet.');
}
// SHA256 Signing
public function testSigning256()
{
+ $this->markTestIncomplete('This test has not been implemented yet.');
}
// Relaxed/Relaxed Hash Signing
public function testSigningRelaxedRelaxed256()
{
+ $this->markTestIncomplete('This test has not been implemented yet.');
}
// Relaxed/Simple Hash Signing
public function testSigningRelaxedSimple256()
{
+ $this->markTestIncomplete('This test has not been implemented yet.');
}
// Simple/Relaxed Hash Signing
public function testSigningSimpleRelaxed256()
{
+ $this->markTestIncomplete('This test has not been implemented yet.');
}
}
diff --git a/tests/unit/Swift/Transport/EsmtpTransportTest.php b/tests/unit/Swift/Transport/EsmtpTransportTest.php
index 31cfa12..82650f5 100644
--- a/tests/unit/Swift/Transport/EsmtpTransportTest.php
+++ b/tests/unit/Swift/Transport/EsmtpTransportTest.php
@@ -46,10 +46,11 @@ class Swift_Transport_EsmtpTransportTest extends Swift_Transport_AbstractSmtpEve
$this->assertEquals('tls', $smtp->getEncryption(), '%s: Crypto should be returned');
}
+ /**
+ * @doesNotPerformAssertions
+ */
public function testStartSendsHeloToInitiate()
{
- // previous loop would fail if there is an issue
- $this->addToAssertionCount(1);
}
public function testStartSendsEhloToInitiate()
|