Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Wolf <git@christianwolf.email>
  • Loading branch information
Christian Wolf committed Mar 15, 2023
1 parent 38d4a3c commit 2684d21
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions tests/Unit/Controller/Implementation/ConfigImplementationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function testList(): void {
* @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');
Expand All @@ -136,6 +136,12 @@ public function testConfig($data, $folderPath, $interval, $printImage): void {
$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
*/
Expand All @@ -147,23 +153,28 @@ public function testConfig($data, $folderPath, $interval, $printImage): void {
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]
],
];
}
Expand Down

0 comments on commit 2684d21

Please sign in to comment.