From 2684d2121ff595c9b657547805da3d91b75b96e5 Mon Sep 17 00:00:00 2001 From: Christian Wolf Date: Wed, 15 Mar 2023 20:51:53 +0100 Subject: [PATCH] Fix unit tests Signed-off-by: Christian Wolf --- .../ConfigImplementationTest.php | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tests/Unit/Controller/Implementation/ConfigImplementationTest.php b/tests/Unit/Controller/Implementation/ConfigImplementationTest.php index 63b727e7..282d0506 100644 --- a/tests/Unit/Controller/Implementation/ConfigImplementationTest.php +++ b/tests/Unit/Controller/Implementation/ConfigImplementationTest.php @@ -111,7 +111,7 @@ class ConfigImplementationTest extends TestCase { * @param mixed $interval * @param mixed $printImage */ - public function testConfig($data, $folderPath, $interval, $printImage): void { + public function testConfig($data, $folderPath, $interval, $printImage, $visibleInfoBlocks): void { $this->restParser->method('getParameters')->willReturn($data); $this->dbCacheService->expects($this->once())->method('triggerCheck'); @@ -136,6 +136,12 @@ class ConfigImplementationTest extends TestCase { $this->recipeService->expects($this->once())->method('setPrintImage')->with($printImage); } + if (is_null($visibleInfoBlocks)) { + $this->recipeService->expects($this->never())->method('setVisibleInfoBlocks'); + } else { + $this->recipeService->expects($this->once())->method('setVisibleInfoBlocks')->with($visibleInfoBlocks); + } + /** * @var JSONResponse $response */ @@ -147,23 +153,28 @@ class ConfigImplementationTest extends TestCase { public function dataProviderConfig() { return [ 'noChange' => [ - [], null, null, null + [], null, null, null, null ], 'changeFolder' => [ - ['folder' => '/path/to/whatever'], '/path/to/whatever', null, null + ['folder' => '/path/to/whatever'], '/path/to/whatever', null, null, null ], 'changeinterval' => [ - ['update_interval' => 15], null, 15, null + ['update_interval' => 15], null, 15, null, null ], 'changePrint' => [ - ['print_image' => true], null, null, true + ['print_image' => true], null, null, true, null + ], + 'changeVisibleBlocks' => [ + ['visibleInfoBlocks' => ['cooking-time' => true, 'preparation-time' => true]], + null, null, null, ['cooking-time' => true, 'preparation-time' => true] ], 'changeAll' => [ [ 'folder' => '/my/custom/path', 'update_interval' => 12, - 'print_image' => false - ], '/my/custom/path', 12, false + 'print_image' => false, + 'visibleInfoBlocks' => ['cooking-time' => true, 'preparation-time' => true], + ], '/my/custom/path', 12, false, ['cooking-time' => true, 'preparation-time' => true] ], ]; }