Update unit test after updating codeception/verify
[MAILPOET-5591]
This commit is contained in:
@@ -37,6 +37,6 @@ class PreprocessManagerTest extends \MailPoetUnitTest {
|
||||
|
||||
$preprocessManager = new PreprocessManager($cleanup, $topLevel, $blocksWidth, $typography);
|
||||
$preprocessManager->registerPreprocessor($secondPreprocessor);
|
||||
expect($preprocessManager->preprocess([], $layoutStyles))->equals([]);
|
||||
verify($preprocessManager->preprocess([], $layoutStyles))->equals([]);
|
||||
}
|
||||
}
|
||||
|
@@ -44,11 +44,11 @@ class BlocksWidthPreprocessorTest extends \MailPoetUnitTest {
|
||||
]];
|
||||
$result = $this->preprocessor->preprocess($blocks, ['width' => '660px', 'padding' => ['left' => '0px', 'right' => '0px']]);
|
||||
$result = $result[0];
|
||||
expect($result['email_attrs']['width'])->equals('660px');
|
||||
expect($result['innerBlocks'])->count(3);
|
||||
expect($result['innerBlocks'][0]['email_attrs']['width'])->equals('330px'); // 660 * 0.5
|
||||
expect($result['innerBlocks'][1]['email_attrs']['width'])->equals('165px'); // 660 * 0.25
|
||||
expect($result['innerBlocks'][2]['email_attrs']['width'])->equals('100px');
|
||||
verify($result['email_attrs']['width'])->equals('660px');
|
||||
verify($result['innerBlocks'])->arrayCount(3);
|
||||
verify($result['innerBlocks'][0]['email_attrs']['width'])->equals('330px'); // 660 * 0.5
|
||||
verify($result['innerBlocks'][1]['email_attrs']['width'])->equals('165px'); // 660 * 0.25
|
||||
verify($result['innerBlocks'][2]['email_attrs']['width'])->equals('100px');
|
||||
}
|
||||
|
||||
public function testItCalculatesWidthWithLayoutPadding(): void {
|
||||
@@ -81,10 +81,10 @@ class BlocksWidthPreprocessorTest extends \MailPoetUnitTest {
|
||||
]];
|
||||
$result = $this->preprocessor->preprocess($blocks, ['width' => '600px', 'padding' => ['left' => '20px', 'right' => '20px']]);
|
||||
$result = $result[0];
|
||||
expect($result['innerBlocks'])->count(3);
|
||||
expect($result['innerBlocks'][0]['email_attrs']['width'])->equals('185px'); // (600 - 20 - 20) * 0.33
|
||||
expect($result['innerBlocks'][1]['email_attrs']['width'])->equals('100px');
|
||||
expect($result['innerBlocks'][2]['email_attrs']['width'])->equals('112px'); // (600 - 20 - 20) * 0.2
|
||||
verify($result['innerBlocks'])->arrayCount(3);
|
||||
verify($result['innerBlocks'][0]['email_attrs']['width'])->equals('185px'); // (600 - 20 - 20) * 0.33
|
||||
verify($result['innerBlocks'][1]['email_attrs']['width'])->equals('100px');
|
||||
verify($result['innerBlocks'][2]['email_attrs']['width'])->equals('112px'); // (600 - 20 - 20) * 0.2
|
||||
}
|
||||
|
||||
public function testItCalculatesWidthOfBlockInColumn(): void {
|
||||
@@ -139,11 +139,11 @@ class BlocksWidthPreprocessorTest extends \MailPoetUnitTest {
|
||||
$result = $this->preprocessor->preprocess($blocks, ['width' => '660px', 'padding' => ['left' => '15px', 'right' => '15px']]);
|
||||
$innerBlocks = $result[0]['innerBlocks'];
|
||||
|
||||
expect($innerBlocks)->count(2);
|
||||
expect($innerBlocks[0]['email_attrs']['width'])->equals('252px'); // (660 - 15 - 15) * 0.4
|
||||
expect($innerBlocks[0]['innerBlocks'][0])->hasNotKey('email_attrs'); // paragraph block should not have width
|
||||
expect($innerBlocks[1]['email_attrs']['width'])->equals('378px'); // (660 - 15 - 15) * 0.6
|
||||
expect($innerBlocks[1]['innerBlocks'][0])->hasNotKey('email_attrs'); // paragraph block should not have width
|
||||
verify($innerBlocks)->arrayCount(2);
|
||||
verify($innerBlocks[0]['email_attrs']['width'])->equals('252px'); // (660 - 15 - 15) * 0.4
|
||||
verify($innerBlocks[0]['innerBlocks'][0])->arrayHasNotKey('email_attrs'); // paragraph block should not have width
|
||||
verify($innerBlocks[1]['email_attrs']['width'])->equals('378px'); // (660 - 15 - 15) * 0.6
|
||||
verify($innerBlocks[1]['innerBlocks'][0])->arrayHasNotKey('email_attrs'); // paragraph block should not have width
|
||||
}
|
||||
|
||||
public function testItAddsMissingColumnWidth(): void {
|
||||
@@ -189,12 +189,12 @@ class BlocksWidthPreprocessorTest extends \MailPoetUnitTest {
|
||||
$result = $this->preprocessor->preprocess($blocks, ['width' => '660px', 'padding' => ['left' => '30px', 'right' => '30px']]);
|
||||
$innerBlocks = $result[0]['innerBlocks'];
|
||||
|
||||
expect($innerBlocks)->count(3);
|
||||
expect($innerBlocks[0]['email_attrs']['width'])->equals('200px'); // (660 - 30 - 30) * 0.33
|
||||
expect($innerBlocks[0]['innerBlocks'][0])->hasNotKey('email_attrs'); // paragraph block should not have width
|
||||
expect($innerBlocks[1]['email_attrs']['width'])->equals('200px'); // (660 - 30 - 30) * 0.33
|
||||
expect($innerBlocks[1]['innerBlocks'][0])->hasNotKey('email_attrs'); // paragraph block should not have width
|
||||
expect($innerBlocks[2]['email_attrs']['width'])->equals('200px'); // (660 - 30 - 30) * 0.33
|
||||
expect($innerBlocks[2]['innerBlocks'][0])->hasNotKey('email_attrs'); // paragraph block should not have width
|
||||
verify($innerBlocks)->arrayCount(3);
|
||||
verify($innerBlocks[0]['email_attrs']['width'])->equals('200px'); // (660 - 30 - 30) * 0.33
|
||||
verify($innerBlocks[0]['innerBlocks'][0])->arrayHasNotKey('email_attrs'); // paragraph block should not have width
|
||||
verify($innerBlocks[1]['email_attrs']['width'])->equals('200px'); // (660 - 30 - 30) * 0.33
|
||||
verify($innerBlocks[1]['innerBlocks'][0])->arrayHasNotKey('email_attrs'); // paragraph block should not have width
|
||||
verify($innerBlocks[2]['email_attrs']['width'])->equals('200px'); // (660 - 30 - 30) * 0.33
|
||||
verify($innerBlocks[2]['innerBlocks'][0])->arrayHasNotKey('email_attrs'); // paragraph block should not have width
|
||||
}
|
||||
}
|
||||
|
@@ -37,9 +37,9 @@ class CleanupPreprocessorTest extends \MailPoetUnitTest {
|
||||
self::PARAGRAPH_BLOCK,
|
||||
];
|
||||
$result = $this->preprocessor->preprocess($blocks, []);
|
||||
expect($result)->count(2);
|
||||
expect($result[0])->equals(self::COLUMNS_BLOCK);
|
||||
expect($result[1])->equals(self::PARAGRAPH_BLOCK);
|
||||
verify($result)->arrayCount(2);
|
||||
verify($result[0])->equals(self::COLUMNS_BLOCK);
|
||||
verify($result[1])->equals(self::PARAGRAPH_BLOCK);
|
||||
}
|
||||
|
||||
public function testItPreservesAllRelevantBlocks(): void {
|
||||
@@ -49,9 +49,9 @@ class CleanupPreprocessorTest extends \MailPoetUnitTest {
|
||||
self::COLUMNS_BLOCK,
|
||||
];
|
||||
$result = $this->preprocessor->preprocess($blocks, []);
|
||||
expect($result)->count(3);
|
||||
expect($result[0])->equals(self::COLUMNS_BLOCK);
|
||||
expect($result[1])->equals(self::PARAGRAPH_BLOCK);
|
||||
expect($result[2])->equals(self::COLUMNS_BLOCK);
|
||||
verify($result)->arrayCount(3);
|
||||
verify($result[0])->equals(self::COLUMNS_BLOCK);
|
||||
verify($result[1])->equals(self::PARAGRAPH_BLOCK);
|
||||
verify($result[2])->equals(self::COLUMNS_BLOCK);
|
||||
}
|
||||
}
|
||||
|
@@ -52,11 +52,11 @@ class TypographyPreprocessorTest extends \MailPoetUnitTest {
|
||||
];
|
||||
$result = $this->preprocessor->preprocess($blocks, []);
|
||||
$result = $result[0];
|
||||
expect($result['innerBlocks'])->count(2);
|
||||
expect($result['email_attrs'])->equals($expectedEmailAttrs);
|
||||
expect($result['innerBlocks'][0]['email_attrs'])->equals($expectedEmailAttrs);
|
||||
expect($result['innerBlocks'][1]['email_attrs'])->equals($expectedEmailAttrs);
|
||||
expect($result['innerBlocks'][1]['innerBlocks'][0]['email_attrs'])->equals($expectedEmailAttrs);
|
||||
verify($result['innerBlocks'])->arrayCount(2);
|
||||
verify($result['email_attrs'])->equals($expectedEmailAttrs);
|
||||
verify($result['innerBlocks'][0]['email_attrs'])->equals($expectedEmailAttrs);
|
||||
verify($result['innerBlocks'][1]['email_attrs'])->equals($expectedEmailAttrs);
|
||||
verify($result['innerBlocks'][1]['innerBlocks'][0]['email_attrs'])->equals($expectedEmailAttrs);
|
||||
}
|
||||
|
||||
public function testItDoesNotCopyColumnsWidth(): void {
|
||||
@@ -85,11 +85,11 @@ class TypographyPreprocessorTest extends \MailPoetUnitTest {
|
||||
]];
|
||||
$result = $this->preprocessor->preprocess($blocks, []);
|
||||
$result = $result[0];
|
||||
expect($result['innerBlocks'])->count(2);
|
||||
expect($result['email_attrs'])->equals(['width' => '640px']);
|
||||
expect($result['innerBlocks'][0]['email_attrs'])->equals([]);
|
||||
expect($result['innerBlocks'][1]['email_attrs'])->equals([]);
|
||||
expect($result['innerBlocks'][1]['innerBlocks'][0]['email_attrs'])->equals([]);
|
||||
verify($result['innerBlocks'])->arrayCount(2);
|
||||
verify($result['email_attrs'])->equals(['width' => '640px']);
|
||||
verify($result['innerBlocks'][0]['email_attrs'])->equals([]);
|
||||
verify($result['innerBlocks'][1]['email_attrs'])->equals([]);
|
||||
verify($result['innerBlocks'][1]['innerBlocks'][0]['email_attrs'])->equals([]);
|
||||
}
|
||||
|
||||
public function testItOverridesColumnsTypography(): void {
|
||||
@@ -182,15 +182,15 @@ class TypographyPreprocessorTest extends \MailPoetUnitTest {
|
||||
$result = $this->preprocessor->preprocess($blocks, []);
|
||||
$child1 = $result[0];
|
||||
$child2 = $result[1];
|
||||
expect($child1['innerBlocks'])->count(2);
|
||||
expect($child1['email_attrs'])->equals($expectedEmailAttrs1);
|
||||
expect($child1['innerBlocks'][0]['email_attrs'])->equals($expectedEmailAttrs2);
|
||||
expect($child1['innerBlocks'][0]['innerBlocks'][0]['email_attrs'])->equals($expectedEmailAttrs2);
|
||||
expect($child1['innerBlocks'][1]['email_attrs'])->equals($expectedEmailAttrs1);
|
||||
expect($child1['innerBlocks'][1]['innerBlocks'][0]['email_attrs'])->equals($expectedEmailAttrs1);
|
||||
expect($child2['innerBlocks'])->count(1);
|
||||
expect($child2['email_attrs'])->equals([]);
|
||||
expect($child2['innerBlocks'][0]['email_attrs'])->equals($expectedEmailAttrs2);
|
||||
expect($child2['innerBlocks'][0]['innerBlocks'][0]['email_attrs'])->equals($expectedEmailAttrs2);
|
||||
verify($child1['innerBlocks'])->arrayCount(2);
|
||||
verify($child1['email_attrs'])->equals($expectedEmailAttrs1);
|
||||
verify($child1['innerBlocks'][0]['email_attrs'])->equals($expectedEmailAttrs2);
|
||||
verify($child1['innerBlocks'][0]['innerBlocks'][0]['email_attrs'])->equals($expectedEmailAttrs2);
|
||||
verify($child1['innerBlocks'][1]['email_attrs'])->equals($expectedEmailAttrs1);
|
||||
verify($child1['innerBlocks'][1]['innerBlocks'][0]['email_attrs'])->equals($expectedEmailAttrs1);
|
||||
verify($child2['innerBlocks'])->arrayCount(1);
|
||||
verify($child2['email_attrs'])->equals([]);
|
||||
verify($child2['innerBlocks'][0]['email_attrs'])->equals($expectedEmailAttrs2);
|
||||
verify($child2['innerBlocks'][0]['innerBlocks'][0]['email_attrs'])->equals($expectedEmailAttrs2);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user