This repository has been archived by the owner on Jul 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix SparkpostTransportMessageTest.php static analysis issues
- Loading branch information
1 parent
120e67e
commit 85fdfe5
Showing
1 changed file
with
7 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
use Mautic\EmailBundle\Mailer\Message\MauticMessage; | ||
use Mautic\EmailBundle\Model\TransportCallback; | ||
use MauticPlugin\SparkpostBundle\Mailer\Transport\SparkpostTransport; | ||
use PHPUnit\Framework\Assert; | ||
use PHPUnit\Framework\TestCase; | ||
use Psr\EventDispatcher\EventDispatcherInterface; | ||
use Psr\Log\LoggerInterface; | ||
|
@@ -59,19 +60,18 @@ public function testCcAndBccFields(): void | |
['tokens' => ['{formfield=first_name}' => '1'], 'emailId' => $emailId, 'emailName' => $internalEmailName] // @phpstan-ignore-line | ||
); | ||
|
||
/** @phpstan-ignore-next-line */ | ||
$message->addMetadata('[email protected]', ['tokens' => ['{formfield=first_name}' => '2']]); // @phpstan-ignore-line | ||
|
||
$sentMessageMock = $this->createMock(SentMessage::class); | ||
$sentMessageMock->method('getOriginalMessage') | ||
->willReturn($message); | ||
|
||
$payload = $this->invokeInaccessibleMethod($sparkpost, 'getSparkpostPayload', [$sentMessageMock]); | ||
$this->assertSame(sprintf('%s:%s', $emailId, $expectedInternalEmailName), $payload['campaign_id']); | ||
$this->assertEquals('[email protected]', $payload['content']['from']); | ||
$this->assertEquals('Test subject', $payload['content']['subject']); | ||
$this->assertEquals('First Name: {{{ FORMFIELDFIRSTNAME }}}', $payload['content']['html']); | ||
$this->assertCount(10, $payload['recipients']); | ||
Assert::assertEquals(sprintf('%s:%s', $emailId, $expectedInternalEmailName), $payload['campaign_id']); | ||
Assert::assertEquals('[email protected]', $payload['content']['from']); | ||
Assert::assertEquals('Test subject', $payload['content']['subject']); | ||
Assert::assertEquals('First Name: {{{ FORMFIELDFIRSTNAME }}}', $payload['content']['html']); | ||
Assert::assertCount(10, $payload['recipients']); | ||
|
||
// CC and BCC fields has to be included as normal recipient with same data as TO fields has | ||
$recipients = [ | ||
|
@@ -171,7 +171,7 @@ public function testCcAndBccFields(): void | |
], | ||
]; | ||
|
||
$this->assertEquals($recipients, $payload['recipients']); | ||
Assert::assertEquals($recipients, $payload['recipients']); | ||
} | ||
|
||
/** | ||
|