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