Attempt to fix mock

This commit is contained in:
Mike Jolley
2024-05-10 14:21:32 +01:00
committed by Rostislav Wolný
parent 5fac09e343
commit 48cc71f98f
2 changed files with 10 additions and 4 deletions

View File

@@ -39,7 +39,7 @@ class SettingsController {
} }
public function getSettings(): array { public function getSettings(): array {
$coreDefaultSettings = get_default_block_editor_settings(); $coreDefaultSettings = \get_default_block_editor_settings();
$themeSettings = $this->themeController->getSettings(); $themeSettings = $this->themeController->getSettings();
// body selector is later transformed to .editor-styles-wrapper // body selector is later transformed to .editor-styles-wrapper
@@ -70,10 +70,10 @@ class SettingsController {
* @return array{contentSize: string, wideSize: string, layout: string} * @return array{contentSize: string, wideSize: string, layout: string}
*/ */
public function getLayout(): array { public function getLayout(): array {
$settings = $this->getSettings(); $themeSettings = $this->themeController->getSettings();
return [ return [
'contentSize' => $settings['__experimentalFeatures']['layout']['contentSize'], 'contentSize' => $themeSettings['layout']['contentSize'],
'wideSize' => $settings['__experimentalFeatures']['layout']['wideSize'], 'wideSize' => $themeSettings['layout']['wideSize'],
'layout' => 'constrained', 'layout' => 'constrained',
]; ];
} }

View File

@@ -9,6 +9,12 @@ class SettingsControllerTest extends \MailPoetUnitTest {
public function testItGetsCorrectLayoutWidthWithoutPadding(): void { public function testItGetsCorrectLayoutWidthWithoutPadding(): void {
$themeJsonMock = $this->createMock(\WP_Theme_JSON::class); $themeJsonMock = $this->createMock(\WP_Theme_JSON::class);
$themeJsonMock->method('get_data')->willReturn([ $themeJsonMock->method('get_data')->willReturn([
'settings' => [
"layout" => [
"contentSize" => "660px",
"wideSize" => "660px",
],
],
'styles' => [ 'styles' => [
'spacing' => [ 'spacing' => [
'padding' => [ 'padding' => [