summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBennet Becker <dev@bennet.cc>2022-12-23 21:48:52 +0100
committerBennet Becker <dev@bennet.cc>2022-12-23 21:48:52 +0100
commit411467af57cf94eb2ee6a90538017640a76d0dcb (patch)
tree89b3e3a4f8313516c577b3d8f6438895c805408d /tests
parent4b992cdf7f2b1b5fa998cca7949a821122dd582f (diff)
downloadnextcloud-server-411467af57cf94eb2ee6a90538017640a76d0dcb.tar.gz
nextcloud-server-411467af57cf94eb2ee6a90538017640a76d0dcb.zip
fix static-analysis error and formatting code
Signed-off-by: Bennet Becker <dev@bennet.cc>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Mail/MessageTest.php43
1 files changed, 4 insertions, 39 deletions
diff --git a/tests/lib/Mail/MessageTest.php b/tests/lib/Mail/MessageTest.php
index aae25497876..cf9a48e29f2 100644
--- a/tests/lib/Mail/MessageTest.php
+++ b/tests/lib/Mail/MessageTest.php
@@ -8,7 +8,6 @@
namespace Test\Mail;
-use Egulias\EmailValidator\EmailValidator;
use OC\Mail\Message;
use OCP\Mail\AutoSubmittedValue;
use OCP\Mail\IEMailTemplate;
@@ -267,11 +266,9 @@ class MessageTest extends TestCase {
}
public function testSetAutoSubmitted1() {
-
$swiftMimeSimpleHeaderSet = $this->getMockBuilder('\Swift_Mime_SimpleHeaderSet')
->disableOriginalConstructor()
->getMock();
-
$swiftMessage = $this->getMockBuilder('\Swift_Message')
->disableOriginalConstructor()
->disableOriginalClone()
@@ -279,37 +276,25 @@ class MessageTest extends TestCase {
->disallowMockingUnknownTypes()
->getMock();
-
$swiftMessage->method('getHeaders')->willReturn($swiftMimeSimpleHeaderSet);
$swiftMimeSimpleHeaderSet->expects($this->once())
->method('has')
->with('Auto-Submitted');
-
$swiftMimeSimpleHeaderSet->expects($this->never())
- ->method('get');
-
+ ->method('remove');
$swiftMimeSimpleHeaderSet->expects($this->once())
->method('addTextHeader')
->with('Auto-Submitted', AutoSubmittedValue::AUTO_GENERATED);
$message = new Message($swiftMessage, false);
-
$message->setAutoSubmitted(AutoSubmittedValue::AUTO_GENERATED);
-
}
public function testSetAutoSubmitted2() {
-
- $swiftMimeHeader = $this->getMockBuilder('\Swift_Mime_Header')
- ->disableOriginalConstructor()
- ->addMethods(['setValue'])
- ->getMockForAbstractClass();
-
$swiftMimeSimpleHeaderSet = $this->getMockBuilder('\Swift_Mime_SimpleHeaderSet')
->disableOriginalConstructor()
->getMock();
-
$swiftMessage = $this->getMockBuilder('\Swift_Message')
->disableOriginalConstructor()
->disableOriginalClone()
@@ -317,38 +302,27 @@ class MessageTest extends TestCase {
->disallowMockingUnknownTypes()
->getMock();
-
$swiftMessage->method('getHeaders')->willReturn($swiftMimeSimpleHeaderSet);
- $swiftMimeSimpleHeaderSet->method('get')->with("Auto-Submitted")->willReturn($swiftMimeHeader);
-
$swiftMimeSimpleHeaderSet->expects($this->once())
->method('has')
->with('Auto-Submitted')
->willReturn(true);
-
$swiftMimeSimpleHeaderSet->expects($this->once())
- ->method('get');
-
- $swiftMimeSimpleHeaderSet->expects($this->never())
+ ->method('remove')
+ ->with('Auto-Submitted');
+ $swiftMimeSimpleHeaderSet->expects($this->once())
->method('addTextHeader')
->with('Auto-Submitted', AutoSubmittedValue::AUTO_GENERATED);
- $swiftMimeHeader->expects($this->once())
- ->method('setValue')
- ->with(AutoSubmittedValue::AUTO_GENERATED);
-
$message = new Message($swiftMessage, false);
-
$message->setAutoSubmitted(AutoSubmittedValue::AUTO_GENERATED);
}
public function testGetAutoSubmitted1() {
-
$swiftMimeSimpleHeaderSet = $this->getMockBuilder('\Swift_Mime_SimpleHeaderSet')
->disableOriginalConstructor()
->getMock();
-
$swiftMessage = $this->getMockBuilder('\Swift_Message')
->disableOriginalConstructor()
->disableOriginalClone()
@@ -356,30 +330,24 @@ class MessageTest extends TestCase {
->disallowMockingUnknownTypes()
->getMock();
-
$swiftMessage->method('getHeaders')->willReturn($swiftMimeSimpleHeaderSet);
$swiftMimeSimpleHeaderSet->expects($this->once())
->method('has')
->with('Auto-Submitted');
-
$swiftMimeSimpleHeaderSet->expects($this->never())
->method('get');
$message = new Message($swiftMessage, false);
-
$this->assertSame("no", $message->getAutoSubmitted());
}
public function testGetAutoSubmitted2() {
-
$swiftMimeHeader = $this->getMockBuilder('\Swift_Mime_Header')
->disableOriginalConstructor()
->getMockForAbstractClass();
-
$swiftMimeSimpleHeaderSet = $this->getMockBuilder('\Swift_Mime_SimpleHeaderSet')
->disableOriginalConstructor()
->getMock();
-
$swiftMessage = $this->getMockBuilder('\Swift_Message')
->disableOriginalConstructor()
->disableOriginalClone()
@@ -395,14 +363,11 @@ class MessageTest extends TestCase {
->method('has')
->with('Auto-Submitted')
->willReturn(true);
-
$swiftMimeSimpleHeaderSet->expects($this->once())
->method('get')
->willReturn($swiftMimeHeader);
$message = new Message($swiftMessage, false);
-
$this->assertSame(AutoSubmittedValue::AUTO_GENERATED, $message->getAutoSubmitted());
-
}
}