Skip to content

Commit 06a893d

Browse files
moodyjmzclaude
andcommitted
fix(overview): update OverviewControllerTest for IConfig and userId params
The controller gained IConfig and userId in the grid-view persistence commit but the test was not updated. Pass the two missing arguments and adjust provideInitialState expectations to cover both calls. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
1 parent 6ad06ac commit 06a893d

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

tests/lib/Controller/OverviewControllerTest.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use OCP\AppFramework\Http\TemplateResponse;
1313
use OCP\AppFramework\Services\IInitialState;
1414
use OCP\EventDispatcher\IEventDispatcher;
15+
use OCP\IConfig;
1516
use OCP\IPreview;
1617
use OCP\IRequest;
1718
use Test\TestCase;
@@ -20,6 +21,7 @@ class OverviewControllerTest extends TestCase {
2021
private IEventDispatcher $eventDispatcher;
2122
private IInitialState $initialState;
2223
private IPreview $preview;
24+
private IConfig $config;
2325
private OverviewController $controller;
2426

2527
protected function setUp(): void {
@@ -28,13 +30,17 @@ protected function setUp(): void {
2830
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);
2931
$this->initialState = $this->createMock(IInitialState::class);
3032
$this->preview = $this->createMock(IPreview::class);
33+
$this->config = $this->createMock(IConfig::class);
34+
$this->config->method('getUserValue')->willReturn('0');
3135

3236
$this->controller = new OverviewController(
3337
'richdocuments',
3438
$this->createMock(IRequest::class),
3539
$this->eventDispatcher,
3640
$this->initialState,
3741
$this->preview,
42+
$this->config,
43+
'test-user',
3844
);
3945
}
4046

@@ -54,9 +60,12 @@ public function testIndexSetsPreviewEnabledTrue(): void {
5460
->with('application/vnd.oasis.opendocument.text')
5561
->willReturn(true);
5662

57-
$this->initialState->expects($this->once())
63+
$this->initialState->expects($this->exactly(2))
5864
->method('provideInitialState')
59-
->with('previewEnabled', true);
65+
->withConsecutive(
66+
['previewEnabled', true],
67+
['overview_config', ['overview_grid_view' => false]]
68+
);
6069

6170
$this->controller->index();
6271
}
@@ -67,9 +76,12 @@ public function testIndexSetsPreviewEnabledFalse(): void {
6776
->with('application/vnd.oasis.opendocument.text')
6877
->willReturn(false);
6978

70-
$this->initialState->expects($this->once())
79+
$this->initialState->expects($this->exactly(2))
7180
->method('provideInitialState')
72-
->with('previewEnabled', false);
81+
->withConsecutive(
82+
['previewEnabled', false],
83+
['overview_config', ['overview_grid_view' => false]]
84+
);
7385

7486
$this->controller->index();
7587
}

0 commit comments

Comments
 (0)