Move assorted tests from integration to unit [MAILPOET-2009]

This commit is contained in:
wxa
2019-04-25 11:11:41 +03:00
committed by M. Shull
parent 994fae79d2
commit 2fd244528d
14 changed files with 59 additions and 33 deletions

View File

@ -0,0 +1,30 @@
<?php
namespace MailPoet\Test\Newsletter\Editor;
use MailPoet\Newsletter\Editor\StructureTransformer;
class StructureTransformerTest extends \MailPoetUnitTest {
function _before() {
parent::_before();
$this->transformer = new StructureTransformer();
}
function testItExtractsImagesAsImageBlocks() {
$html = '<p><i>italic</i><em>previous text<a href="#mylink"><img src="#myimage" /></a>next text</em><b>bolded</b></p>';
$blocks = $this->transformer->transform($html, false);
expect($blocks)->count(3);
expect($blocks[0]['type'])->equals('text');
expect($blocks[0]['text'])->equals('<p><i>italic</i><em>previous text</em></p>');
expect($blocks[1]['type'])->equals('image');
expect($blocks[1]['src'])->equals('#myimage');
expect($blocks[1]['link'])->equals('#mylink');
expect($blocks[2]['type'])->equals('text');
expect($blocks[2]['text'])->equals('<p><em>next text</em><b>bolded</b></p>');
}
}