Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Toflar committed Sep 17, 2024
1 parent 1af134f commit 2aab579
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/Parcel/Stamp/Mailer/EmailStamp.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class EmailStamp implements StampInterface
*/
private array $attachmentVouchers = [];

/**
* @var array<string>
*/
private array $embeddedImageVouchers = [];

public function withFromName(string $fromName): self
Expand Down Expand Up @@ -108,6 +111,9 @@ public function withHtml(string $html): self
return $clone;
}

/**
* @return array<string>
*/
public function getEmbeddedImageVouchers(): array
{
return $this->embeddedImageVouchers;
Expand Down
6 changes: 6 additions & 0 deletions tests/BulkyItem/InMemoryDbafs.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@

class InMemoryDbafs implements DbafsInterface
{
/**
* @var array<string, FilesystemItem>
*/
private array $records = [];

/**
* @var array<string, array<mixed>>
*/
private array $meta = [];

public function getPathFromUuid(Uuid $uuid): string|null
Expand Down
3 changes: 3 additions & 0 deletions tests/BulkyItem/VirtualFilesystemCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

class VirtualFilesystemCollection
{
/**
* @param array<string, VirtualFilesystem> $vfs
*/
public function __construct(private array $vfs = [])
{
}
Expand Down
6 changes: 4 additions & 2 deletions tests/EventListener/AdminEmailTokenListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Contao\CoreBundle\Framework\ContaoFramework;
use Contao\PageModel;
use Contao\TestCase\ContaoTestCase;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Terminal42\NotificationCenterBundle\Config\MessageConfig;
Expand Down Expand Up @@ -48,7 +47,10 @@ public function testAddsAdminTokens(string $configFriendlyEmail, string $pageFri
$this->assertSame($expectedEmail, $tokenCollection->getByName('admin_email')->getValue());
}

public static function adminEmailProvider(): \Generator
/**
* @return iterable<array{0: string, 1: string, 2: string, 3: string}>
*/
public static function adminEmailProvider(): iterable
{
yield 'Basic admin email in config' => [
'foobar-config@terminal42.ch',
Expand Down
10 changes: 8 additions & 2 deletions tests/Gateway/MailerGatewayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class MailerGatewayTest extends ContaoTestCase
{
/**
* @dataProvider embeddingHtmlImagesProvider
*
* @param array<string, string> $mockFiles
* @param array<string, string> $expectedAttachmentsContentsAndPath
*/
public function testEmbeddingHtmlImages(string $parsedTemplateHtml, array $mockFiles, array $expectedAttachmentsContentsAndPath): void
{
Expand Down Expand Up @@ -80,7 +83,7 @@ static function (Email $email) use ($parsedTemplateHtml, $expectedAttachmentsCon
$parcel = $parcel->withStamp(new TokenCollectionStamp($tokenCollection));

$gateway = new MailerGateway(
$this->createFrameWorkWithTemplate('mail_default', $parsedTemplateHtml),
$this->createFrameWorkWithTemplate($parsedTemplateHtml),
$vfsCollection->get('files'),
$mailer,
);
Expand All @@ -93,6 +96,9 @@ static function (Email $email) use ($parsedTemplateHtml, $expectedAttachmentsCon
$gateway->sendParcel($parcel);
}

/**
* @return iterable<array{0: string, 1: array<string, string>, 2: array<string, string>}>
*/
public static function embeddingHtmlImagesProvider(): iterable
{
yield 'Test embeds a relative upload path' => [
Expand Down Expand Up @@ -135,7 +141,7 @@ private function createVfsCollection(): VirtualFilesystemCollection
return $vfsCollection;
}

private function createFrameWorkWithTemplate(string $templateName, string $parsedTemplateHtml): ContaoFramework
private function createFrameWorkWithTemplate(string $parsedTemplateHtml): ContaoFramework
{
$controllerAdapter = $this->mockAdapter(['convertRelativeUrls']);
$controllerAdapter
Expand Down
6 changes: 6 additions & 0 deletions tests/Token/TokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public function testArrayParserFormat(array $value, string $expectedParserValue)
$this->assertSame($expectedParserValue, $token->getParserValue());
}

/**
* @return iterable<array{0: array<mixed>, 1: string}>
*/
public static function arrayProvider(): iterable
{
yield 'Simple list array token' => [
Expand Down Expand Up @@ -65,6 +68,9 @@ public static function arrayProvider(): iterable
];
}

/**
* @return iterable<array{0: mixed, 1: string}>
*/
public static function anythingProvider(): iterable
{
yield [
Expand Down

0 comments on commit 2aab579

Please sign in to comment.