diff --git a/CHANGELOG.md b/CHANGELOG.md index 1234cd402..b2668be78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ [#2003](https://github.com/nextcloud/cookbook/pull/2003) @j0hannesr0th - Fix yield not set calculation error [#2099](https://github.com/nextcloud/cookbook/pull/2099) @j0hannesr0th +- Output correct stubs for tags, search and categories in the API + [#2270](https://github.com/nextcloud/cookbook/pull/2270) @christianlupus ### Documentation - Improve structure of `README.md` diff --git a/lib/Controller/Implementation/RecipeImplementation.php b/lib/Controller/Implementation/RecipeImplementation.php index 74bf456e0..3fb1c9332 100644 --- a/lib/Controller/Implementation/RecipeImplementation.php +++ b/lib/Controller/Implementation/RecipeImplementation.php @@ -280,6 +280,8 @@ public function search($query) { 'size' => 'thumb16' ] ); + + $recipes[$i] = $this->stubFilter->apply($recipes[$i]); } return new JSONResponse($recipes, 200, ['Content-Type' => 'application/json']); @@ -316,6 +318,8 @@ public function getAllInCategory($category) { 'size' => 'thumb16' ] ); + + $recipes[$i] = $this->stubFilter->apply($recipes[$i]); } return new JSONResponse($recipes, Http::STATUS_OK, ['Content-Type' => 'application/json']); @@ -356,6 +360,8 @@ public function getAllWithTags($keywords) { 'size' => 'thumb16' ] ); + + $recipes[$i] = $this->stubFilter->apply($recipes[$i]); } return new JSONResponse($recipes, Http::STATUS_OK, ['Content-Type' => 'application/json']); diff --git a/tests/Unit/Controller/Implementation/RecipeImplementationTest.php b/tests/Unit/Controller/Implementation/RecipeImplementationTest.php index 9fb4f85d4..64e465a80 100644 --- a/tests/Unit/Controller/Implementation/RecipeImplementationTest.php +++ b/tests/Unit/Controller/Implementation/RecipeImplementationTest.php @@ -178,6 +178,7 @@ public function testCategory($cat, $recipes): void { $this->ensureCacheCheckTriggered(); $this->recipeService->method('getRecipesByCategory')->with($cat)->willReturn($recipes); + $this->stubFilter->method('apply')->willReturnArgument(0); $expected = $this->getExpectedRecipes($recipes); @@ -263,6 +264,7 @@ public function testTags($keywords, $recipes): void { $this->ensureCacheCheckTriggered(); $this->recipeService->method('getRecipesByKeywords')->with($keywords)->willReturn($recipes); + $this->stubFilter->method('apply')->willReturnArgument(0); $expected = $this->getExpectedRecipes($recipes); @@ -336,6 +338,7 @@ public function testSearch($query, $recipes): void { $this->ensureCacheCheckTriggered(); $this->recipeService->expects($this->once())->method('findRecipesInSearchIndex')->with($query)->willReturn($recipes); + $this->stubFilter->method('apply')->willReturnArgument(0); $expected = $this->getExpectedRecipes($recipes);