Skip to content

Commit 3109926

Browse files
committed
test(PhishingDetection): Fix broken integration tests due to signature changes
Signed-off-by: David Dreschner <[email protected]>
1 parent 0309552 commit 3109926

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tests/Integration/Service/Phishing/PhishingDetectionServiceIntegrationTest.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use OCA\Mail\Service\PhishingDetection\ContactCheck;
1616
use OCA\Mail\Service\PhishingDetection\CustomEmailCheck;
1717
use OCA\Mail\Service\PhishingDetection\DateCheck;
18+
use OCA\Mail\Service\PhishingDetection\ImapFlagCheck;
1819
use OCA\Mail\Service\PhishingDetection\LinkCheck;
1920
use OCA\Mail\Service\PhishingDetection\PhishingDetectionService;
2021
use OCA\Mail\Service\PhishingDetection\ReplyToCheck;
@@ -24,7 +25,6 @@
2425
use PHPUnit\Framework\MockObject\MockObject;
2526

2627
class PhishingDetectionServiceIntegrationTest extends TestCase {
27-
2828
private ContactsIntegration|MockObject $contactsIntegration;
2929
private IL10N|MockObject $l10n;
3030
private ITimeFactory $timeFactory;
@@ -33,6 +33,7 @@ class PhishingDetectionServiceIntegrationTest extends TestCase {
3333
private DateCheck $dateCheck;
3434
private ReplyToCheck $replyToCheck;
3535
private LinkCheck $linkCheck;
36+
private ImapFlagCheck $imapFlagCheck;
3637
private PhishingDetectionService $service;
3738

3839
protected function setUp(): void {
@@ -44,19 +45,17 @@ protected function setUp(): void {
4445
$this->dateCheck = new DateCheck($this->l10n, \OC::$server->get(ITimeFactory::class));
4546
$this->replyToCheck = new ReplyToCheck($this->l10n);
4647
$this->linkCheck = new LinkCheck($this->l10n);
47-
$this->service = new PhishingDetectionService($this->contactCheck, $this->customEmailCheck, $this->dateCheck, $this->replyToCheck, $this->linkCheck);
48+
$this->imapFlagCheck = new ImapFlagCheck($this->l10n);
49+
$this->service = new PhishingDetectionService($this->contactCheck, $this->customEmailCheck, $this->dateCheck, $this->replyToCheck, $this->linkCheck, $this->imapFlagCheck);
4850
}
4951

50-
51-
5252
public function testContactCheck(): void {
5353
$this->contactsIntegration->expects(self::once())
5454
->method('getContactsWithName')
5555
->with('John Doe')
5656
->willReturn([['id' => 1, 'fn' => 'John Doe', 'email' => ['[email protected]','[email protected]']]]);
5757

5858
$result = $this->contactCheck->run('John Doe', '[email protected]');
59-
6059
$this->assertTrue($result->isPhishing());
6160
}
6261

@@ -69,12 +68,12 @@ public function testReplyToCheck(): void {
6968
$result = $this->replyToCheck->run('[email protected]', '[email protected]');
7069
$this->assertTrue($result->isPhishing());
7170
}
71+
7272
public function testCheckHeadersForPhishing(): void {
7373
$headerStream = fopen(__DIR__ . '/../../../data/phishing-mail-headers.txt', 'r');
7474
$parsedHeaders = Horde_Mime_Headers::parseHeaders($headerStream);
7575
fclose($headerStream);
76-
$result = $this->service->checkHeadersForPhishing($parsedHeaders, false);
76+
$result = $this->service->checkHeadersForPhishing($parsedHeaders, [], false);
7777
$this->assertTrue($result['warning']);
7878
}
79-
8079
}

0 commit comments

Comments
 (0)