diff --git a/src/Request/Products/ProductProjectionSearchRequest.php b/src/Request/Products/ProductProjectionSearchRequest.php index 36922c85b5..5225ac08f0 100644 --- a/src/Request/Products/ProductProjectionSearchRequest.php +++ b/src/Request/Products/ProductProjectionSearchRequest.php @@ -166,6 +166,17 @@ public function fuzzy($level) return $this; } + /** + * @param $mark + * @return $this + */ + public function markMatchingVariants($mark) + { + $this->addParamObject(new Parameter('markMatchingVariants', $mark)); + + return $this; + } + /** * @return string * @internal diff --git a/tests/unit/Request/Products/ProductProjectionSearchRequestTest.php b/tests/unit/Request/Products/ProductProjectionSearchRequestTest.php index c926cbddbc..45bde3f907 100644 --- a/tests/unit/Request/Products/ProductProjectionSearchRequestTest.php +++ b/tests/unit/Request/Products/ProductProjectionSearchRequestTest.php @@ -28,6 +28,32 @@ public function testFuzzy() $this->assertSame('fuzzy=true', (string)$httpRequest->getBody()); } + public function testMarkMatchingVariant() + { + /** + * @var ProductProjectionSearchRequest $request + */ + $request = $this->getRequest(static::PRODUCT_PROJECTION_SEARCH_REQUEST); + $request->markMatchingVariants(true); + $httpRequest = $request->httpRequest(); + + $this->assertSame('product-projections/search', (string)$httpRequest->getUri()); + $this->assertSame('markMatchingVariants=true', (string)$httpRequest->getBody()); + } + + public function testDontMarkMatchingVariant() + { + /** + * @var ProductProjectionSearchRequest $request + */ + $request = $this->getRequest(static::PRODUCT_PROJECTION_SEARCH_REQUEST); + $request->markMatchingVariants(false); + $httpRequest = $request->httpRequest(); + + $this->assertSame('product-projections/search', (string)$httpRequest->getUri()); + $this->assertSame('markMatchingVariants=false', (string)$httpRequest->getBody()); + } + public function fuzzyProvider() { return [