Fix namespace in unit tests

[MAILPOET-6216]
This commit is contained in:
Jan Lysý
2024-09-18 18:56:31 +02:00
committed by Jan Lysý
parent 246a10f058
commit 99a6541ffb
11 changed files with 14 additions and 16 deletions

View File

@ -0,0 +1,32 @@
<?php declare(strict_types = 1);
namespace MailPoet\EmailEditor\Engine;
class SettingsControllerTest extends \MailPoetUnitTest {
public function testItGetsCorrectLayoutWidthWithoutPadding(): void {
$themeJsonMock = $this->createMock(\WP_Theme_JSON::class);
$themeJsonMock->method('get_data')->willReturn([
'styles' => [
'spacing' => [
'padding' => [
'left' => '10px',
'right' => '10px',
],
],
],
]);
$themeController = $this->createMock(ThemeController::class);
$themeController->method('getTheme')->willReturn($themeJsonMock);
$themeController->method('getSettings')->willReturn([
"layout" => [
"contentSize" => "660px",
"wideSize" => "660px",
],
]);
$settingsController = new SettingsController($themeController);
$layoutWidth = $settingsController->getLayoutWidthWithoutPadding();
// default width is 660px and if we subtract padding from left and right we must get the correct value
$expectedWidth = (int)SettingsController::EMAIL_WIDTH - 10 * 2;
$this->assertEquals($expectedWidth . 'px', $layoutWidth);
}
}