Skip to content

Commit

Permalink
Test Data-URI message rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
pabzm committed Jan 3, 2025
1 parent 30d3ca8 commit 698570d
Show file tree
Hide file tree
Showing 2 changed files with 6,765 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/MessageRendering/DataUriImagesTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Tests\MessageRendering;

/**
* Test class to test simple messages.
*/
class DataUriImagesTest extends MessageRenderingTestCase
{
public function testImageFromDataUri()
{
$domxpath = $this->runAndGetHtmlOutputDomxpath('trinity-eb9e559b-1926-4b09-990d-80e9da9a9c35-1723163091112@3c-app-mailcom-bs14');

$this->assertSame('***SPAM*** wir gratulieren Ihnen recht herzlich.', $this->getScrubbedSubject($domxpath));

$divElements = $domxpath->query('//div[@class="rcmBody"]/div/div');
$this->assertCount(3, $divElements, 'Body HTML DIV elements');

$this->assertSame('wir gratulieren Ihnen recht herzlich.', $divElements[0]->textContent);

$img = $divElements[1]->firstChild->firstChild;
$this->assertSame('img', $img->nodeName);
$src = $img->attributes->getNamedItem('src')->textContent;
$this->assertStringContainsString('?_task=mail&_action=get&_mbox=INBOX&_uid=', $src);
$this->assertStringContainsString('&_part=2&_embed=1&_mimeclass=image', $src);

$this->assertSame('v1signature', $divElements[2]->attributes->getNamedItem('class')->textContent);
# This matches a non-breakable space.
$this->assertMatchesRegularExpression("|^\x{00a0}$|u", $divElements[2]->textContent);
}
}
Loading

0 comments on commit 698570d

Please sign in to comment.