Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Commit

Permalink
feat(Search): add markMatchingVariants flag to search
Browse files Browse the repository at this point in the history
Closes #270
  • Loading branch information
Jens Schulze committed Nov 16, 2016
1 parent 583f656 commit f4ac2c8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Request/Products/ProductProjectionSearchRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions tests/unit/Request/Products/ProductProjectionSearchRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down

0 comments on commit f4ac2c8

Please # to comment.