@@ -144,6 +144,54 @@ public function testShowNoToken(?string $acceptHeader, string $expectedHeader):
144144 $ this ->assertStringContainsString ($ description , $ renderedResponse );
145145 }
146146
147+ public function testShowWithFilter (): void {
148+ $ this ->mockUserSession ('test ' );
149+ $ this ->data
150+ ->method ('validateFilter ' )
151+ ->with ('files ' )
152+ ->willReturn ('files ' );
153+ $ this ->data
154+ ->expects ($ this ->once ())
155+ ->method ('get ' )
156+ ->with ($ this ->helper , $ this ->userSettings , 'test ' , 0 , FeedController::DEFAULT_PAGE_SIZE , 'desc ' , 'files ' )
157+ ->willReturn (['data ' => []]);
158+
159+ $ templateResponse = $ this ->controller ->show ('files ' );
160+ $ this ->assertInstanceOf (TemplateResponse::class, $ templateResponse );
161+ }
162+
163+ public function testShowWithInvalidFilter (): void {
164+ $ this ->mockUserSession ('test ' );
165+ $ this ->data
166+ ->method ('validateFilter ' )
167+ ->with ('invalid_filter ' )
168+ ->willReturn ('all ' );
169+ $ this ->data
170+ ->expects ($ this ->once ())
171+ ->method ('get ' )
172+ ->with ($ this ->helper , $ this ->userSettings , 'test ' , 0 , FeedController::DEFAULT_PAGE_SIZE , 'desc ' , 'all ' )
173+ ->willReturn (['data ' => []]);
174+
175+ $ templateResponse = $ this ->controller ->show ('invalid_filter ' );
176+ $ this ->assertInstanceOf (TemplateResponse::class, $ templateResponse );
177+ }
178+
179+ public function testShowDefaultsToAllFilter (): void {
180+ $ this ->mockUserSession ('test ' );
181+ $ this ->data
182+ ->method ('validateFilter ' )
183+ ->with ('all ' )
184+ ->willReturn ('all ' );
185+ $ this ->data
186+ ->expects ($ this ->once ())
187+ ->method ('get ' )
188+ ->with ($ this ->helper , $ this ->userSettings , 'test ' , 0 , FeedController::DEFAULT_PAGE_SIZE , 'desc ' , 'all ' )
189+ ->willReturn (['data ' => []]);
190+
191+ $ templateResponse = $ this ->controller ->show ();
192+ $ this ->assertInstanceOf (TemplateResponse::class, $ templateResponse );
193+ }
194+
147195 protected function mockUserSession (string $ user ): void {
148196 $ mockUser = $ this ->createMock (IUser::class);
149197 $ mockUser
0 commit comments