Rename files in email editor package by WP Coding Standard
[MAILPOET-6240]
This commit is contained in:
@@ -2,15 +2,15 @@
|
||||
|
||||
namespace MailPoet\EmailEditor\Engine\Renderer\Postprocessors;
|
||||
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Postprocessors\HighlightingPostprocessor;
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Postprocessors\Highlighting_Postprocessor;
|
||||
|
||||
class HighlightingPostprocessorTest extends \MailPoetUnitTest {
|
||||
/** @var HighlightingPostprocessor */
|
||||
class Highlighting_Postprocessor_Test extends \MailPoetUnitTest {
|
||||
/** @var Highlighting_Postprocessor */
|
||||
private $postprocessor;
|
||||
|
||||
public function _before() {
|
||||
parent::_before();
|
||||
$this->postprocessor = new HighlightingPostprocessor();
|
||||
$this->postprocessor = new Highlighting_Postprocessor();
|
||||
}
|
||||
|
||||
public function testItReplacesHtmlElements(): void {
|
@@ -2,20 +2,20 @@
|
||||
|
||||
namespace MailPoet\EmailEditor\Engine\Renderer\Postprocessors;
|
||||
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Postprocessors\VariablesPostprocessor;
|
||||
use MailPoet\EmailEditor\Engine\ThemeController;
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Postprocessors\Variables_Postprocessor;
|
||||
use MailPoet\EmailEditor\Engine\Theme_Controller;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
|
||||
class VariablesPostprocessorTest extends \MailPoetUnitTest {
|
||||
private VariablesPostprocessor $postprocessor;
|
||||
class Variables_Postprocessor_Test extends \MailPoetUnitTest {
|
||||
private Variables_Postprocessor $postprocessor;
|
||||
|
||||
/** @var ThemeController & MockObject */
|
||||
/** @var Theme_Controller & MockObject */
|
||||
private $themeControllerMock;
|
||||
|
||||
public function _before() {
|
||||
parent::_before();
|
||||
$this->themeControllerMock = $this->createMock(ThemeController::class);
|
||||
$this->postprocessor = new VariablesPostprocessor($this->themeControllerMock);
|
||||
$this->themeControllerMock = $this->createMock(Theme_Controller::class);
|
||||
$this->postprocessor = new Variables_Postprocessor($this->themeControllerMock);
|
||||
}
|
||||
|
||||
public function testItReplacesVariablesInStyleAttributes(): void {
|
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace MailPoet\EmailEditor\Engine\Renderer\Preprocessors;
|
||||
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors\BlocksWidthPreprocessor;
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors\Blocks_Width_Preprocessor;
|
||||
|
||||
class BlocksWidthPreprocessorTest extends \MailPoetUnitTest {
|
||||
class Blocks_Width_Preprocessor_Test extends \MailPoetUnitTest {
|
||||
|
||||
/** @var BlocksWidthPreprocessor */
|
||||
/** @var Blocks_Width_Preprocessor */
|
||||
private $preprocessor;
|
||||
|
||||
/** @var array{contentSize: string} */
|
||||
@@ -17,7 +17,7 @@ class BlocksWidthPreprocessorTest extends \MailPoetUnitTest {
|
||||
|
||||
public function _before() {
|
||||
parent::_before();
|
||||
$this->preprocessor = new BlocksWidthPreprocessor();
|
||||
$this->preprocessor = new Blocks_Width_Preprocessor();
|
||||
$this->layout = ['contentSize' => '660px'];
|
||||
$this->styles = ['spacing' => ['padding' => ['left' => '10px', 'right' => '10px', 'top' => '10px', 'bottom' => '10px'], 'blockGap' => '10px']];
|
||||
}
|
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace MailPoet\EmailEditor\Engine\Renderer\Preprocessors;
|
||||
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors\CleanupPreprocessor;
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors\Cleanup_Preprocessor;
|
||||
|
||||
class CleanupPreprocessorTest extends \MailPoetUnitTest {
|
||||
class Cleanup_Preprocessor_Test extends \MailPoetUnitTest {
|
||||
|
||||
private const PARAGRAPH_BLOCK = [
|
||||
'blockName' => 'core/paragraph',
|
||||
@@ -22,7 +22,7 @@ class CleanupPreprocessorTest extends \MailPoetUnitTest {
|
||||
]],
|
||||
];
|
||||
|
||||
/** @var CleanupPreprocessor */
|
||||
/** @var Cleanup_Preprocessor */
|
||||
private $preprocessor;
|
||||
|
||||
/** @var array{contentSize: string} */
|
||||
@@ -33,7 +33,7 @@ class CleanupPreprocessorTest extends \MailPoetUnitTest {
|
||||
|
||||
public function _before() {
|
||||
parent::_before();
|
||||
$this->preprocessor = new CleanupPreprocessor();
|
||||
$this->preprocessor = new Cleanup_Preprocessor();
|
||||
$this->layout = ['contentSize' => '660px'];
|
||||
$this->styles = ['spacing' => ['padding' => ['left' => '10px', 'right' => '10px', 'top' => '10px', 'bottom' => '10px'], 'blockGap' => '10px']];
|
||||
}
|
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace MailPoet\EmailEditor\Engine\Renderer\Preprocessors;
|
||||
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors\SpacingPreprocessor;
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors\Spacing_Preprocessor;
|
||||
|
||||
class SpacingPreprocessorTest extends \MailPoetUnitTest {
|
||||
class Spacing_Preprocessor_Test extends \MailPoetUnitTest {
|
||||
|
||||
/** @var SpacingPreprocessor */
|
||||
/** @var Spacing_Preprocessor */
|
||||
private $preprocessor;
|
||||
|
||||
/** @var array{contentSize: string} */
|
||||
@@ -17,7 +17,7 @@ class SpacingPreprocessorTest extends \MailPoetUnitTest {
|
||||
|
||||
public function _before() {
|
||||
parent::_before();
|
||||
$this->preprocessor = new SpacingPreprocessor();
|
||||
$this->preprocessor = new Spacing_Preprocessor();
|
||||
$this->layout = ['contentSize' => '660px'];
|
||||
$this->styles = ['spacing' => ['padding' => ['left' => '10px', 'right' => '10px', 'top' => '10px', 'bottom' => '10px'], 'blockGap' => '10px']];
|
||||
}
|
@@ -2,12 +2,12 @@
|
||||
|
||||
namespace MailPoet\EmailEditor\Engine\Renderer\Preprocessors;
|
||||
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors\TypographyPreprocessor;
|
||||
use MailPoet\EmailEditor\Engine\SettingsController;
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors\Typography_Preprocessor;
|
||||
use MailPoet\EmailEditor\Engine\Settings_Controller;
|
||||
|
||||
class TypographyPreprocessorTest extends \MailPoetUnitTest {
|
||||
class Typography_Preprocessor_Test extends \MailPoetUnitTest {
|
||||
|
||||
/** @var TypographyPreprocessor */
|
||||
/** @var Typography_Preprocessor */
|
||||
private $preprocessor;
|
||||
|
||||
/** @var array{contentSize: string} */
|
||||
@@ -18,7 +18,7 @@ class TypographyPreprocessorTest extends \MailPoetUnitTest {
|
||||
|
||||
public function _before() {
|
||||
parent::_before();
|
||||
$settingsMock = $this->createMock(SettingsController::class);
|
||||
$settingsMock = $this->createMock(Settings_Controller::class);
|
||||
$themeMock = $this->createMock(\WP_Theme_JSON::class);
|
||||
$themeMock->method('get_data')->willReturn([
|
||||
'styles' => [
|
||||
@@ -52,7 +52,7 @@ class TypographyPreprocessorTest extends \MailPoetUnitTest {
|
||||
$settingsMock->method('translateSlugToFontSize')->willReturnCallback(function($slug) {
|
||||
return str_replace('slug-', '', $slug);
|
||||
});
|
||||
$this->preprocessor = new TypographyPreprocessor($settingsMock);
|
||||
$this->preprocessor = new Typography_Preprocessor($settingsMock);
|
||||
$this->layout = ['contentSize' => '660px'];
|
||||
$this->styles = ['spacing' => ['padding' => ['left' => '10px', 'right' => '10px', 'top' => '10px', 'bottom' => '10px'], 'blockGap' => '10px']];
|
||||
}
|
@@ -2,15 +2,15 @@
|
||||
|
||||
namespace MailPoet\EmailEditor\Engine\Renderer;
|
||||
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Postprocessors\HighlightingPostprocessor;
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Postprocessors\VariablesPostprocessor;
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors\BlocksWidthPreprocessor;
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors\CleanupPreprocessor;
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors\SpacingPreprocessor;
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors\TypographyPreprocessor;
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\ProcessManager;
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Postprocessors\Highlighting_Postprocessor;
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Postprocessors\Variables_Postprocessor;
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors\Blocks_Width_Preprocessor;
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors\Cleanup_Preprocessor;
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors\Spacing_Preprocessor;
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors\Typography_Preprocessor;
|
||||
use MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Process_Manager;
|
||||
|
||||
class ProcessManagerTest extends \MailPoetUnitTest {
|
||||
class Process_Manager_Test extends \MailPoetUnitTest {
|
||||
public function testItCallsPreprocessorsProperly(): void {
|
||||
$layout = [
|
||||
'contentSize' => '600px',
|
||||
@@ -27,25 +27,25 @@ class ProcessManagerTest extends \MailPoetUnitTest {
|
||||
],
|
||||
];
|
||||
|
||||
$cleanup = $this->createMock(CleanupPreprocessor::class);
|
||||
$cleanup = $this->createMock(Cleanup_Preprocessor::class);
|
||||
$cleanup->expects($this->once())->method('preprocess')->willReturn([]);
|
||||
|
||||
$blocksWidth = $this->createMock(BlocksWidthPreprocessor::class);
|
||||
$blocksWidth = $this->createMock(Blocks_Width_Preprocessor::class);
|
||||
$blocksWidth->expects($this->once())->method('preprocess')->willReturn([]);
|
||||
|
||||
$typography = $this->createMock(TypographyPreprocessor::class);
|
||||
$typography = $this->createMock(Typography_Preprocessor::class);
|
||||
$typography->expects($this->once())->method('preprocess')->willReturn([]);
|
||||
|
||||
$spacing = $this->createMock(SpacingPreprocessor::class);
|
||||
$spacing = $this->createMock(Spacing_Preprocessor::class);
|
||||
$spacing->expects($this->once())->method('preprocess')->willReturn([]);
|
||||
|
||||
$highlighting = $this->createMock(HighlightingPostprocessor::class);
|
||||
$highlighting = $this->createMock(Highlighting_Postprocessor::class);
|
||||
$highlighting->expects($this->once())->method('postprocess')->willReturn('');
|
||||
|
||||
$variables = $this->createMock(VariablesPostprocessor::class);
|
||||
$variables = $this->createMock(Variables_Postprocessor::class);
|
||||
$variables->expects($this->once())->method('postprocess')->willReturn('');
|
||||
|
||||
$processManager = new ProcessManager($cleanup, $blocksWidth, $typography, $spacing, $highlighting, $variables);
|
||||
$processManager = new Process_Manager($cleanup, $blocksWidth, $typography, $spacing, $highlighting, $variables);
|
||||
$this->assertEquals([], $processManager->preprocess([], $layout, $styles));
|
||||
$this->assertEmpty($processManager->postprocess(''));
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace MailPoet\EmailEditor\Engine;
|
||||
|
||||
class SettingsControllerTest extends \MailPoetUnitTest {
|
||||
class Settings_Controller_Test extends \MailPoetUnitTest {
|
||||
public function testItGetsCorrectLayoutWidthWithoutPadding(): void {
|
||||
$themeJsonMock = $this->createMock(\WP_Theme_JSON::class);
|
||||
$themeJsonMock->method('get_data')->willReturn([
|
||||
@@ -15,13 +15,13 @@ class SettingsControllerTest extends \MailPoetUnitTest {
|
||||
],
|
||||
],
|
||||
]);
|
||||
$themeController = $this->createMock(ThemeController::class);
|
||||
$themeController = $this->createMock(Theme_Controller::class);
|
||||
$themeController->method('getTheme')->willReturn($themeJsonMock);
|
||||
$themeController->method('getLayoutSettings')->willReturn([
|
||||
"contentSize" => "660px",
|
||||
"wideSize" => null,
|
||||
]);
|
||||
$settingsController = new SettingsController($themeController);
|
||||
$settingsController = new Settings_Controller($themeController);
|
||||
$layoutWidth = $settingsController->getLayoutWidthWithoutPadding();
|
||||
// default width is 660px and if we subtract padding from left and right we must get the correct value
|
||||
$expectedWidth = 660 - 10 * 2;
|
Reference in New Issue
Block a user